diff options
author | 2019-05-23 11:31:34 +0200 | |
---|---|---|
committer | 2019-05-23 11:31:34 +0200 | |
commit | 333f8624f1cc1c21e100819d0224c957c4285112 (patch) | |
tree | 57df290e934ca3674dc81bb65cd9a728d34e27ca /src/stores | |
parent | Merge pull request #1425 from meetfranz/fix/workspace-services-ordering-bug (diff) | |
download | ferdium-app-333f8624f1cc1c21e100819d0224c957c4285112.tar.gz ferdium-app-333f8624f1cc1c21e100819d0224c957c4285112.tar.zst ferdium-app-333f8624f1cc1c21e100819d0224c957c4285112.zip |
logout user when access token is invalid
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/GlobalErrorStore.js | 7 | ||||
-rw-r--r-- | src/stores/UserStore.js | 3 |
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 | } |