aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-04 14:49:24 +0200
committerLibravatar GitHub <noreply@github.com>2019-06-04 14:49:24 +0200
commitb034249d544f9a4f632407d0d1d38e8194992e49 (patch)
tree209497a0aeaeda876098d9adca4cdd84035c9fc4 /src
parentMerge pull request #1443 from meetfranz/feature/multilingual-announcements (diff)
parentlogout user when access token is invalid (diff)
downloadferdium-app-b034249d544f9a4f632407d0d1d38e8194992e49.tar.gz
ferdium-app-b034249d544f9a4f632407d0d1d38e8194992e49.tar.zst
ferdium-app-b034249d544f9a4f632407d0d1d38e8194992e49.zip
fix(App): Fix logout when access token becomes invalid
Diffstat (limited to 'src')
-rw-r--r--src/stores/GlobalErrorStore.js7
-rw-r--r--src/stores/UserStore.js3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/stores/GlobalErrorStore.js b/src/stores/GlobalErrorStore.js
index 90bf751c3..7a85c2daa 100644
--- a/src/stores/GlobalErrorStore.js
+++ b/src/stores/GlobalErrorStore.js
@@ -18,8 +18,11 @@ export default class GlobalErrorStore extends Store {
18 this.error = request.error; 18 this.error = request.error;
19 19
20 if (request.error.json) { 20 if (request.error.json) {
21 this.response = await request.error.json(); 21 try {
22 22 this.response = await request.error.json();
23 } catch (error) {
24 this.response = {};
25 }
23 if (this.error.status === 401) { 26 if (this.error.status === 401) {
24 this.actions.user.logout({ serverLogout: true }); 27 this.actions.user.logout({ serverLogout: true });
25 } 28 }
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 31555dd5c..b5423af3b 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -329,8 +329,7 @@ export default class UserStore extends Store {
329 authToken, 329 authToken,
330 }); 330 });
331 } catch (err) { 331 } catch (err) {
332 console.error('AccessToken Invalid'); 332 this._logout();
333
334 return false; 333 return false;
335 } 334 }
336 } 335 }