diff --git a/frontend/components/DiscordButton.tsx b/frontend/components/DiscordButton.tsx index 2d47fc93..d0572c40 100644 --- a/frontend/components/DiscordButton.tsx +++ b/frontend/components/DiscordButton.tsx @@ -8,18 +8,14 @@ type DiscordButtonProps = { } export function DiscordButton({ disableOnAuth }: DiscordButtonProps) { - const { authenticate, clear, isConnecting, isAuthenticated, profile } = useDiscordAuth(); + const { authenticate, clear, isConnecting, isAuthenticated, profile } = + useDiscordAuth() const { logo, text } = useMemo(() => { if (isAuthenticated) return { logo: profile?.image ? ( - user image + user image ) : ( ), @@ -36,13 +32,12 @@ export function DiscordButton({ disableOnAuth }: DiscordButtonProps) { ); - }; - \ No newline at end of file + const router = useRouter() + useEffect(() => { + const { token = '', error = 'N/A', expires = '0' } = getCodeFromUrl() + localStorage.setItem('discord.token', token) + localStorage.setItem('discord.error', error) + localStorage.setItem('discord.expires', expiresAsDate(expires)) + window.close() + }, [router]) + return +}