fix error boundary flashing on signout action

This commit is contained in:
2025-09-10 06:42:39 +03:00
parent e0adc2fb68
commit 4f99e32009
2 changed files with 10 additions and 6 deletions

View File

@@ -126,18 +126,22 @@ export async function login(_currentState: unknown, formData: FormData) {
}
}
export async function medusaLogout(countryCode = 'ee') {
export async function medusaLogout(countryCode = 'ee', canRevalidateTags = true) {
await sdk.auth.logout()
await removeAuthToken()
const customerCacheTag = await getCacheTag("customers")
revalidateTag(customerCacheTag)
if (canRevalidateTags) {
const customerCacheTag = await getCacheTag("customers")
revalidateTag(customerCacheTag)
}
await removeCartId()
const cartCacheTag = await getCacheTag("carts")
revalidateTag(cartCacheTag)
if (canRevalidateTags) {
const cartCacheTag = await getCacheTag("carts")
revalidateTag(cartCacheTag)
}
}
export async function transferCart() {

View File

@@ -10,7 +10,7 @@ export function useSignOut() {
try {
try {
const { medusaLogout } = await import('../../../features/medusa-storefront/src/lib/data/customer');
await medusaLogout();
await medusaLogout(undefined, false);
} catch (medusaError) {
console.warn('Medusa logout failed or not available:', medusaError);
}