summaryrefslogtreecommitdiffstats
path: root/js/service/SettingsResource.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 03:51:37 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 03:51:37 +0200
commit21445917b001de0af6d6abf7eb71eeef6b0ec38a (patch)
treeb3b86321c270642b0645d01d6e7796997a93d8c1 /js/service/SettingsResource.js
parent02adea04a5f65640acbce0c954b3b48a61bacb9a (diff)
rename settings to settingsresource
Diffstat (limited to 'js/service/SettingsResource.js')
-rw-r--r--js/service/SettingsResource.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/js/service/SettingsResource.js b/js/service/SettingsResource.js
new file mode 100644
index 000000000..26b26145d
--- /dev/null
+++ b/js/service/SettingsResource.js
@@ -0,0 +1,40 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+
+ /*jshint unused:false*/
+app.service('SettingsResource', function ($http, BASE_URL) {
+ 'use strict';
+
+ this.settings = {};
+
+ this.receive = (data) => {
+ for (let [key, value] of items(data)) {
+ this.settings[key] = value;
+ }
+ };
+
+ this.get = (key) => {
+ return this.settings[key];
+ };
+
+ this.set = (key, value) => {
+ this.settings[key] = value;
+
+ let data = {};
+ data[key] = value;
+
+ return $http({
+ url: `${BASE_URL}/settings`,
+ method: 'POST',
+ data: data
+ });
+ };
+
+}); \ No newline at end of file