diff --git a/frontend/src/apis/AuthenticationAPI.ts b/frontend/src/apis/AuthenticationAPI.ts index d51a943..867db5e 100644 --- a/frontend/src/apis/AuthenticationAPI.ts +++ b/frontend/src/apis/AuthenticationAPI.ts @@ -44,7 +44,7 @@ const getSession = async () => { if (error) { throw error } else { - return { session} + return {session} } } catch (error) { console.error(error) diff --git a/frontend/src/contexts/AuthContext.tsx b/frontend/src/contexts/AuthContext.tsx index f734609..484c61d 100644 --- a/frontend/src/contexts/AuthContext.tsx +++ b/frontend/src/contexts/AuthContext.tsx @@ -106,10 +106,14 @@ function AuthProvider({ children }: AuthProviderProps) { console.log("AuthenContext - getSession") try { const session = await ApiGetSession(); - dispatch({ type: "getSession", payload: { session } }) + console.log("isSession?", session) + if (session.session) { + dispatch({ type: "getSession", payload: { session } }) + } } catch (error) { console.error(error) throw error; + } } @@ -128,7 +132,6 @@ function AuthProvider({ children }: AuthProviderProps) { const signup = async (email: string, password: string) => { console.log("AuthenContext - signup") try { - console.log("hehh") const { user, session } = await ApiSignup(email, password) .catch(error => { console.error('Error during signup:', error);