diff --git a/src/Common/Constants/global.ts b/src/Common/Constants/global.ts index f2be7ae..ca2ebeb 100644 --- a/src/Common/Constants/global.ts +++ b/src/Common/Constants/global.ts @@ -1,7 +1,5 @@ export const ENV = process.env.REACT_APP_ENV || "LOCAL"; -console.log(ENV); - export const enum envs { LOCAL = "LOCAL", PROD = "PROD", diff --git a/src/Utils/auth.ts b/src/Utils/auth.ts index 17ce369..4121a50 100644 --- a/src/Utils/auth.ts +++ b/src/Utils/auth.ts @@ -1,15 +1,28 @@ const fetchUser = async () => { - const response = await fetch( - `${process.env.REACT_APP_SERVER_URL}/auth/profile`, - { - credentials: "include", // Important! Allows sending the session cookie - } - ); + // const response = await fetch( + // `${process.env.REACT_APP_SERVER_URL}/auth/profile`, + // { + // credentials: "include", // Important! Allows sending the session cookie + // } + // ); + // + // if (response.ok) { + // return await response.json(); // user data // e.g. { _id, displayName, email } + // } else { + // return null; + // } + + try { + const response = await fetch( + `${process.env.REACT_APP_SERVER_URL}/auth/profile`, + { + credentials: "include", // Important! Allows sending the session cookie + } + ); - if (response.ok) { return await response.json(); // user data // e.g. { _id, displayName, email } - } else { - return null; + } catch (e) { + console.error(e); } };