diff options
Diffstat (limited to 'src/stores/UserStore.js')
-rw-r--r-- | src/stores/UserStore.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index c1ed2944a..7b4d39524 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js | |||
@@ -3,6 +3,7 @@ import moment from 'moment'; | |||
3 | import jwt from 'jsonwebtoken'; | 3 | import jwt from 'jsonwebtoken'; |
4 | import localStorage from 'mobx-localstorage'; | 4 | import localStorage from 'mobx-localstorage'; |
5 | import ms from 'ms'; | 5 | import ms from 'ms'; |
6 | import { remote } from 'electron'; | ||
6 | 7 | ||
7 | import { isDevMode } from '../environment'; | 8 | import { isDevMode } from '../environment'; |
8 | import Store from './lib/Store'; | 9 | import Store from './lib/Store'; |
@@ -11,6 +12,9 @@ import CachedRequest from './lib/CachedRequest'; | |||
11 | import { sleep } from '../helpers/async-helpers'; | 12 | import { sleep } from '../helpers/async-helpers'; |
12 | import { getPlan } from '../helpers/plan-helpers'; | 13 | import { getPlan } from '../helpers/plan-helpers'; |
13 | import { PLANS } from '../config'; | 14 | import { PLANS } from '../config'; |
15 | import { TODOS_PARTITION_ID } from '../features/todos'; | ||
16 | |||
17 | const { session } = remote; | ||
14 | 18 | ||
15 | const debug = require('debug')('Ferdi:UserStore'); | 19 | const debug = require('debug')('Ferdi:UserStore'); |
16 | 20 | ||
@@ -28,6 +32,8 @@ export default class UserStore extends Store { | |||
28 | 32 | ||
29 | PRICING_ROUTE = `${this.BASE_ROUTE}/signup/pricing`; | 33 | PRICING_ROUTE = `${this.BASE_ROUTE}/signup/pricing`; |
30 | 34 | ||
35 | SETUP_ROUTE = `${this.BASE_ROUTE}/signup/setup`; | ||
36 | |||
31 | IMPORT_ROUTE = `${this.BASE_ROUTE}/signup/import`; | 37 | IMPORT_ROUTE = `${this.BASE_ROUTE}/signup/import`; |
32 | 38 | ||
33 | INVITE_ROUTE = `${this.BASE_ROUTE}/signup/invite`; | 39 | INVITE_ROUTE = `${this.BASE_ROUTE}/signup/invite`; |
@@ -127,6 +133,10 @@ export default class UserStore extends Store { | |||
127 | return this.PRICING_ROUTE; | 133 | return this.PRICING_ROUTE; |
128 | } | 134 | } |
129 | 135 | ||
136 | get setupRoute() { | ||
137 | return this.SETUP_ROUTE; | ||
138 | } | ||
139 | |||
130 | get inviteRoute() { | 140 | get inviteRoute() { |
131 | return this.INVITE_ROUTE; | 141 | return this.INVITE_ROUTE; |
132 | } | 142 | } |
@@ -227,7 +237,7 @@ export default class UserStore extends Store { | |||
227 | 237 | ||
228 | this._setUserData(authToken); | 238 | this._setUserData(authToken); |
229 | 239 | ||
230 | this.stores.router.push('/'); | 240 | this.stores.router.push(this.SETUP_ROUTE); |
231 | } | 241 | } |
232 | 242 | ||
233 | @action async _retrievePassword({ email }) { | 243 | @action async _retrievePassword({ email }) { |
@@ -285,6 +295,13 @@ export default class UserStore extends Store { | |||
285 | 295 | ||
286 | this.getUserInfoRequest.invalidate().reset(); | 296 | this.getUserInfoRequest.invalidate().reset(); |
287 | this.authToken = null; | 297 | this.authToken = null; |
298 | |||
299 | this.stores.services.allServicesRequest.invalidate().reset(); | ||
300 | |||
301 | if (this.stores.todos.isTodosEnabled) { | ||
302 | const sess = session.fromPartition(TODOS_PARTITION_ID); | ||
303 | sess.clearStorageData(); | ||
304 | } | ||
288 | } | 305 | } |
289 | 306 | ||
290 | @action async _importLegacyServices({ services }) { | 307 | @action async _importLegacyServices({ services }) { |