Skip to content

Commit

Permalink
refactor: make debug logs warn instead of error
Browse files Browse the repository at this point in the history
In an unauthenticated RSC we still check the tokens, which means we're called getAccessToken and getIdToken which will always return null. This is expected behaviour, so using console.error miscommunicates the intention.
  • Loading branch information
Yoshify committed Dec 18, 2024
1 parent e8ced3b commit 2f5eb9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/getAccessToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getAccessToken = async (

if (!token || typeof token !== "string") {
if (config.isDebugMode) {
console.error("getAccessToken: invalid token or token is missing");
console.warn("getAccessToken: invalid token or token is missing (are you logged in?)");
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getIdToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getIdToken = async (req: NextApiRequest, res?: NextApiResponse) =>

if (!token || typeof token !== "string") {
if (config.isDebugMode) {
console.error("getIdToken: invalid token or token is missing");
console.warn("getIdToken: invalid token or token is missing (are you logged in?)");
}
return null;
}
Expand Down

0 comments on commit 2f5eb9c

Please sign in to comment.