Skip to content

Commit

Permalink
add debugging console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dauglyon committed Feb 26, 2024
1 parent d1c816a commit 207d668
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/cookie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export function setCookie(
SameSite?: 'Lax' | 'Strict' | 'None';
}
) {
// eslint-disable-next-line no-console
console.log('setCookie', { name, value, options });
if (!name) throw new Error('cannot set unnamed cookie');
const { expires, path, domain, secure, SameSite } = {
path: '/',
Expand Down
4 changes: 4 additions & 0 deletions src/features/auth/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export const useTokenCookie = (

// Initializes auth for states where useTryAuthFromToken does not set auth
useEffect(() => {
// eslint-disable-next-line no-console
console.log({ cookieToken, isUninitialized, isFetching, isSuccess, token });
// If the cookieToken is present but it failed checks and wont be overwritten by a token in state, clear
if (
cookieToken &&
Expand All @@ -57,6 +59,8 @@ export const useTokenCookie = (
!isSuccess &&
!token
) {
// eslint-disable-next-line no-console
console.log('clearing');
dispatch(setAuth(null));
clearCookieToken();
// clear backup token too, if it exists
Expand Down

0 comments on commit 207d668

Please sign in to comment.