File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,6 @@ export function updateSettings(formValues) {
282282 resolve ( ) ;
283283 return ;
284284 }
285-
286285 submitSettings ( formValues )
287286 . then ( ( response ) => {
288287 dispatch ( updateSettingsSuccess ( response . data ) ) ;
@@ -291,8 +290,24 @@ export function updateSettings(formValues) {
291290 resolve ( ) ;
292291 } )
293292 . catch ( ( error ) => {
294- dispatch ( showToast ( 5500 ) ) ;
295- dispatch ( setToastText ( 'Toast.IncorrectCurrentPass' ) ) ;
293+ if ( error . response ) {
294+ switch ( error . response . status ) {
295+ case 401 :
296+ dispatch ( showToast ( 5500 ) ) ;
297+ dispatch ( setToastText ( 'Toast.IncorrectCurrentPass' ) ) ;
298+ break ;
299+ case 404 :
300+ dispatch ( showToast ( 5500 ) ) ;
301+ dispatch ( setToastText ( 'Toast.UserNotFound' ) ) ;
302+ break ;
303+ default :
304+ dispatch ( showToast ( 5500 ) ) ;
305+ dispatch ( setToastText ( 'Toast.DefaultError' ) ) ;
306+ }
307+ } else {
308+ dispatch ( showToast ( 5500 ) ) ;
309+ dispatch ( setToastText ( 'Toast.NetworkError' ) ) ;
310+ }
296311 } ) ;
297312 } ) ;
298313}
Original file line number Diff line number Diff line change 113113 "AutosaveEnabled" : " Autosave enabled." ,
114114 "LangChange" : " Language changed" ,
115115 "SettingsSaved" : " Settings saved." ,
116- "EmptyCurrentPass" : " Current Password field is empty" ,
117- "IncorrectCurrentPass" : " Current Password is incorrect"
116+ "EmptyCurrentPass" : " Current password field is empty" ,
117+ "IncorrectCurrentPass" : " Current password is incorrect" ,
118+ "DefaultError" :" Something went wrong" ,
119+ "UserNotFound" : " User not found" ,
120+ "NetworkError" : " Network error"
118121 },
119122 "Toolbar" : {
120123 "Preview" : " Preview" ,
Original file line number Diff line number Diff line change 114114 "LangChange" : " भाषा बदली" ,
115115 "SettingsSaved" : " सेटिंग्स सेव की" ,
116116 "EmptyCurrentPass" : " वर्तमान पासवर्ड फ़ील्ड खाली है" ,
117- "IncorrectCurrentPass" : " वर्तमान पासवर्ड गलत है "
117+ "IncorrectCurrentPass" : " वर्तमान पासवर्ड गलत है " ,
118+ "DefaultError" :" कुछ गलत हो गया" ,
119+ "UserNotFound" : " उपयोगकर्ता नहीं मिला" ,
120+ "NetworkError" : " नेटवर्क त्रुटि"
118121 },
119122 "Toolbar" : {
120123 "Preview" : " पूर्वावलोकन" ,
You can’t perform that action at this time.
0 commit comments