WIP: Successful Google Auth, broke pretty much everything else in the process

This commit is contained in:
Tom Moor
2018-05-28 11:36:37 -07:00
parent 1ba5c1cf96
commit ddd2b82d20
33 changed files with 443 additions and 387 deletions

View File

@@ -15,7 +15,12 @@ type Props = {
let authenticatedStores;
const Auth = ({ children }: Props) => {
if (stores.auth.authenticated && stores.auth.team && stores.auth.user) {
if (stores.auth.authenticated) {
if (!stores.auth.team || !stores.auth.user) {
stores.auth.fetch();
return null;
}
// Only initialize stores once. Kept in global scope because otherwise they
// will get overridden on route change
if (!authenticatedStores) {
@@ -42,7 +47,6 @@ const Auth = ({ children }: Props) => {
};
}
stores.auth.fetch();
authenticatedStores.collections.fetchPage({ limit: 100 });
}

View File

@@ -123,7 +123,9 @@ class AuthStore {
}
this.user = data.user;
this.team = data.team;
this.token = data.token;
this.token = Cookie.get('accessToken') || data.token;
console.log('TOKEN', this.token);
this.oauthState = data.oauthState;
autorun(() => {