Skip to content

Commit

Permalink
fix: redirectUrl env variable can't be read from a callback
Browse files Browse the repository at this point in the history
  • Loading branch information
SeDemal committed Apr 26, 2024
1 parent f183521 commit d3adf5a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/layout/header/AvatarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const AvatarMenu = () => {
const { data: sessionData } = useSession();
const { colorScheme, toggleColorScheme } = useColorScheme();

const redirectUrl = env.NEXT_PUBLIC_LOGOUT_REDIRECT_URL;

const Icon = colorScheme === 'dark' ? IconSun : IconMoonStars;
const defaultBoardHref = useBoardLink('/board');

Expand Down Expand Up @@ -69,9 +71,8 @@ export const AvatarMenu = () => {
signOut({
redirect: false,
}).then(() => {
alert(env.NEXT_PUBLIC_LOGOUT_REDIRECT_URL ?? "this bish empty, yeet");
env.NEXT_PUBLIC_LOGOUT_REDIRECT_URL
? window.location.assign(env.NEXT_PUBLIC_LOGOUT_REDIRECT_URL)
redirectUrl
? window.location.assign(redirectUrl)
: window.location.reload();
});
}}
Expand Down

0 comments on commit d3adf5a

Please sign in to comment.