فهرست منبع

Reset the settings as well

Johannes Zellner 11 سال پیش
والد
کامیت
9bc85c34fb
2فایلهای تغییر یافته به همراه10 افزوده شده و 7 حذف شده
  1. 9 7
      frontend/js/core.js
  2. 1 0
      frontend/js/main.js

+ 9 - 7
frontend/js/core.js

@@ -37,7 +37,6 @@ function ThingsApi() {
     this._addCallbacks = [];
     this._editCallbacks = [];
     this._delCallbacks = [];
-    this.data = [];
     this._operation = '';
 }
 
@@ -60,11 +59,11 @@ ThingsApi.prototype.get = function (filter, callback) {
         if (error) return callback(error);
         if (result.status !== 200) return callback(new Error('Failed: ' + result.status + '. ' + result.text));
 
-        that.data = result.body.things.map(function (thing) {
+        var tmp = result.body.things.map(function (thing) {
             return new Thing(thing._id, new Date(thing.createdAt).getTime(), thing.tags, thing.content, thing.richContent);
         });
 
-        callback(null, that.data);
+        callback(null, tmp);
     }));
 };
 
@@ -131,12 +130,15 @@ ThingsApi.prototype.export = function () {
 
 function SettingsApi() {
     this._changeCallbacks = [];
-    this.data = {
-        title: '',
-        backgroundUrl: ''
-    };
+    this.data = {};
+    this.reset();
 }
 
+SettingsApi.prototype.reset = function () {
+    this.data.title = 'Guacamoly';
+    this.data.backgroundUrl =  '';
+};
+
 SettingsApi.prototype.save = function (callback) {
     superagent.post(url('/api/settings')).send({ settings: this.data }).end(errorWrapper(function (error, result) {
         if (error) return callback(error);

+ 1 - 0
frontend/js/main.js

@@ -94,6 +94,7 @@ function reset() {
     vue.search = '';
     vue.username = '';
     vue.password = '';
+    Core.settings.reset();
 }
 
 function main() {