🐛 Fix login error (#932)

This commit is contained in:
Luke Vella 2023-11-08 16:14:09 +00:00 committed by GitHub
parent 3f6a5603b3
commit e3aacbe668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 141 additions and 176 deletions

View file

@ -22,7 +22,6 @@ import {
UserPlusIcon,
} from "lucide-react";
import Link from "next/link";
import { signOut } from "next-auth/react";
import { LoginLink } from "@/components/login-link";
import { RegisterLink } from "@/components/register-link";
@ -147,25 +146,25 @@ export const UserDropdown = () => {
<Trans i18nKey="createAnAccount" defaults="Register" />
</RegisterLink>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="flex items-center gap-x-2"
onSelect={() =>
signOut({
redirect: false,
})
}
asChild
className="flex text-destructive items-center gap-x-2"
>
<RefreshCcwIcon className="h-4 w-4" />
<Trans i18nKey="forgetMe" />
{/* Don't use signOut() from next-auth. It doesn't work in vercel-production env. I don't know why. */}
<a href="/logout">
<RefreshCcwIcon className="h-4 w-4" />
<Trans i18nKey="forgetMe" />
</a>
</DropdownMenuItem>
</IfGuest>
<IfAuthenticated>
<DropdownMenuItem
className="flex items-center gap-x-2"
onSelect={() => signOut()}
>
<LogOutIcon className="h-4 w-4" />
<Trans i18nKey="logout" />
<DropdownMenuItem asChild className="flex items-center gap-x-2">
{/* Don't use signOut() from next-auth. It doesn't work in vercel-production env. I don't know why. */}
<a href="/logout">
<LogOutIcon className="h-4 w-4" />
<Trans i18nKey="logout" />
</a>
</DropdownMenuItem>
</IfAuthenticated>
</DropdownMenuContent>