Skip to content

Commit

Permalink
🛠️: When visiting a page without a local session, it shows a white sc…
Browse files Browse the repository at this point in the history
…reen.
  • Loading branch information
hereAlexT committed Nov 29, 2023
1 parent 193e1fa commit 9ba8f9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/apis/AuthenticationAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const getSession = async () => {
if (error) {
throw error
} else {
return { session}
return {session}
}
} catch (error) {
console.error(error)
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}

Expand All @@ -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);
Expand Down

0 comments on commit 9ba8f9e

Please sign in to comment.