aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UserStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/UserStore.js')
-rw-r--r--src/stores/UserStore.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 7dbbd955b..c151f6d59 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -9,6 +9,8 @@ import Request from './lib/Request';
9import CachedRequest from './lib/CachedRequest'; 9import CachedRequest from './lib/CachedRequest';
10import { gaEvent } from '../lib/analytics'; 10import { gaEvent } from '../lib/analytics';
11 11
12const debug = require('debug')('UserStore');
13
12// TODO: split stores into UserStore and AuthStore 14// TODO: split stores into UserStore and AuthStore
13export default class UserStore extends Store { 15export default class UserStore extends Store {
14 BASE_ROUTE = '/auth'; 16 BASE_ROUTE = '/auth';
@@ -69,6 +71,11 @@ export default class UserStore extends Store {
69 ]); 71 ]);
70 } 72 }
71 73
74 setup() {
75 // Data migration
76 this._migrateUserLocale();
77 }
78
72 // Routes 79 // Routes
73 get loginRoute() { 80 get loginRoute() {
74 return this.LOGIN_ROUTE; 81 return this.LOGIN_ROUTE;
@@ -292,4 +299,17 @@ export default class UserStore extends Store {
292 this.id = null; 299 this.id = null;
293 } 300 }
294 } 301 }
302
303 async _migrateUserLocale() {
304 await this.getUserInfoRequest._promise;
305
306 if (!this.data.locale) {
307 debug('Migrate "locale" to user data');
308 this.actions.user.update({
309 userData: {
310 locale: this.stores.app.locale,
311 },
312 });
313 }
314 }
295} 315}