Add logout callback URL and session expiration environment variables (#2023)
Co-authored-by: @Meierschlumpf
This commit is contained in:
@@ -14,6 +14,7 @@ import { signOut, useSession } from 'next-auth/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import Link from 'next/link';
|
||||
import { forwardRef } from 'react';
|
||||
import { useLogoutUrl } from '~/hooks/custom-session-provider';
|
||||
import { useColorScheme } from '~/hooks/use-colorscheme';
|
||||
|
||||
import { useBoardLink } from '../Templates/BoardLayout';
|
||||
@@ -26,6 +27,8 @@ export const AvatarMenu = () => {
|
||||
const Icon = colorScheme === 'dark' ? IconSun : IconMoonStars;
|
||||
const defaultBoardHref = useBoardLink('/board');
|
||||
|
||||
const logoutUrl = useLogoutUrl();
|
||||
|
||||
return (
|
||||
<Menu width={256}>
|
||||
<Menu.Target>
|
||||
@@ -64,11 +67,13 @@ export const AvatarMenu = () => {
|
||||
<Menu.Item
|
||||
icon={<IconLogout size="1rem" />}
|
||||
color="red"
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
signOut({
|
||||
redirect: false,
|
||||
}).then(() => window.location.reload())
|
||||
}
|
||||
}).then(() =>
|
||||
logoutUrl ? window.location.assign(logoutUrl) : window.location.reload()
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t('actions.avatar.logout', {
|
||||
username: sessionData.user.name,
|
||||
|
||||
Reference in New Issue
Block a user