log out of medusa and reset cart on supabase logout

This commit is contained in:
2025-09-05 14:15:03 +03:00
parent c6f56f6e11
commit 95e72bb3f8
2 changed files with 7 additions and 3 deletions

View File

@@ -127,7 +127,7 @@ export async function login(_currentState: unknown, formData: FormData) {
}
}
export async function signout(countryCode: string) {
export async function signout(countryCode?: string, shouldRedirect = true) {
await sdk.auth.logout()
await removeAuthToken()
@@ -140,7 +140,9 @@ export async function signout(countryCode: string) {
const cartCacheTag = await getCacheTag("carts")
revalidateTag(cartCacheTag)
redirect(`/${countryCode}/account`)
if (shouldRedirect) {
redirect(`/${countryCode!}/account`)
}
}
export async function transferCart() {