add logout button

This commit is contained in:
tedraykov
2024-06-21 18:58:58 +03:00
parent aa29b3071d
commit 5517ccbd07
4 changed files with 74 additions and 30 deletions

View File

@@ -493,7 +493,7 @@ export async function logout(request: NextRequest, origin: string) {
//if there is no idToken, then sending to logout url will redirect shopify, so just
//redirect to login here and delete cookies (presumably they don't even exist)
if (!idTokenValue) {
const logoutUrl = new URL(`${origin}/login`);
const logoutUrl = new URL(`${origin}`);
const response = NextResponse.redirect(`${logoutUrl}`);
return removeAllCookies(response);
}