@@ -66,6 +66,7 @@ const store = new Vuex.Store({
6666 state . settings . locale = payload . value ;
6767 i18n . locale = payload . value ;
6868
69+ const that = this ;
6970 dbSettings . get ( 'locale' )
7071 . then ( ( doc ) => {
7172 doc . value = payload . value ;
@@ -78,7 +79,7 @@ const store = new Vuex.Store({
7879 value : payload . value ,
7980 } ) ;
8081 } else {
81- // TODO
82+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
8283 }
8384 } ) ;
8485
@@ -93,6 +94,7 @@ const store = new Vuex.Store({
9394 }
9495 state . settings . darkMode = payload . value ;
9596
97+ const that = this ;
9698 dbSettings . get ( 'dark_mode' )
9799 . then ( ( doc ) => {
98100 doc . value = payload . value ;
@@ -105,7 +107,7 @@ const store = new Vuex.Store({
105107 value : payload . value ,
106108 } ) ;
107109 } else {
108- // TODO
110+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
109111 }
110112 } ) ;
111113
@@ -121,6 +123,7 @@ const store = new Vuex.Store({
121123 payload . value = payload . value . trim ( ) ;
122124 state . settings . couchUrl = payload . value ;
123125
126+ const that = this ;
124127 dbSettings . get ( 'couch_url' )
125128 . then ( ( doc ) => {
126129 doc . value = payload . value ;
@@ -133,7 +136,7 @@ const store = new Vuex.Store({
133136 value : payload . value ,
134137 } ) ;
135138 } else {
136- // TODO
139+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
137140 }
138141 } ) ;
139142 } else {
@@ -147,6 +150,7 @@ const store = new Vuex.Store({
147150 }
148151 state . settings . allowAutomaticUpdate = payload . value ;
149152
153+ const that = this ;
150154 dbSettings . get ( 'allow_automatic_update' )
151155 . then ( ( doc ) => {
152156 doc . value = payload . value ;
@@ -159,7 +163,7 @@ const store = new Vuex.Store({
159163 value : payload . value ,
160164 } ) ;
161165 } else {
162- // TODO
166+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
163167 }
164168 } ) ;
165169 } else {
@@ -226,7 +230,7 @@ const store = new Vuex.Store({
226230 reject ( err ) ;
227231 } ) ;
228232 } else {
229- reject ( { message : 'not ok ' } ) ; // TODO
233+ reject ( { message : 'error while saving document ' } ) ;
230234 }
231235 } ;
232236
@@ -284,6 +288,7 @@ const store = new Vuex.Store({
284288 } ;
285289 }
286290
291+ const that = this ;
287292 new Promise ( ( resolve ) => {
288293 if ( dbSync !== null && store . state . settings . couchUrl !== store . state . settings . currentSync ) {
289294 context . dispatch ( 'stopSyncDB' ) . then ( ( ) => { resolve ( ) ; } ) ;
@@ -306,10 +311,14 @@ const store = new Vuex.Store({
306311 } , 2000 ) ;
307312 }
308313 } )
309- . on ( 'error' , ( err ) => { alert ( 'CPE0006: Error while synchronising database : ' + err ) ; } ) ; // TODO
314+ . on ( 'error' , ( err ) => {
315+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
316+ } ) ;
310317 }
311318 } )
312- . catch ( ( err ) => { alert ( 'CPE0007: ' + err ) ; } ) ;
319+ . catch ( ( err ) => {
320+ that . $toasted . show ( err , { duration : 4000 , type : 'error' , icon : 'warning' } ) ;
321+ } ) ;
313322 } ,
314323 stopSyncDB ( ) {
315324 return new Promise ( ( resolve ) => {
@@ -414,7 +423,7 @@ db.changes({
414423 }
415424 } )
416425 . on ( 'error' , ( err ) => {
417- console . log ( 'zrfrfgazrgerg' , err ) ;
426+ console . log ( err ) ;
418427 } ) ;
419428
420429export default store ;
0 commit comments