Merge branch 'master' into dashboard-improves
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
import { observable, action, computed, autorunAsync } from 'mobx';
|
||||
import invariant from 'invariant';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import UserStore from 'stores/UserStore';
|
||||
import type { User, Team } from 'types';
|
||||
|
||||
const AUTH_STORE = 'AUTH_STORE';
|
||||
@@ -72,17 +71,6 @@ class AuthStore {
|
||||
};
|
||||
};
|
||||
|
||||
getUserStore(): UserStore {
|
||||
invariant(
|
||||
this.user && this.team,
|
||||
'Tried to create a user store without data'
|
||||
);
|
||||
return new UserStore({
|
||||
user: this.user,
|
||||
team: this.team,
|
||||
});
|
||||
}
|
||||
|
||||
constructor() {
|
||||
// Rehydrate
|
||||
const data = JSON.parse(localStorage.getItem(AUTH_STORE) || '{}');
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// @flow
|
||||
import { observable, computed } from 'mobx';
|
||||
import type { User, Team } from 'types';
|
||||
|
||||
type Options = {
|
||||
user: User,
|
||||
team: Team,
|
||||
};
|
||||
|
||||
class UserStore {
|
||||
@observable user: User;
|
||||
@observable team: Team;
|
||||
|
||||
@observable isLoading: boolean = false;
|
||||
|
||||
/* Computed */
|
||||
|
||||
@computed get asJson(): string {
|
||||
return JSON.stringify({
|
||||
user: this.user,
|
||||
team: this.team,
|
||||
});
|
||||
}
|
||||
|
||||
constructor(options: Options) {
|
||||
// Rehydrate
|
||||
this.user = options.user;
|
||||
this.team = options.team;
|
||||
}
|
||||
}
|
||||
|
||||
export default UserStore;
|
||||
Reference in New Issue
Block a user