WIP: Successful Google Auth, broke pretty much everything else in the process
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user