fix error boundary flashing on signout action
This commit is contained in:
@@ -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 sdk.auth.logout()
|
||||||
|
|
||||||
await removeAuthToken()
|
await removeAuthToken()
|
||||||
|
|
||||||
const customerCacheTag = await getCacheTag("customers")
|
if (canRevalidateTags) {
|
||||||
revalidateTag(customerCacheTag)
|
const customerCacheTag = await getCacheTag("customers")
|
||||||
|
revalidateTag(customerCacheTag)
|
||||||
|
}
|
||||||
|
|
||||||
await removeCartId()
|
await removeCartId()
|
||||||
|
|
||||||
const cartCacheTag = await getCacheTag("carts")
|
if (canRevalidateTags) {
|
||||||
revalidateTag(cartCacheTag)
|
const cartCacheTag = await getCacheTag("carts")
|
||||||
|
revalidateTag(cartCacheTag)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function transferCart() {
|
export async function transferCart() {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function useSignOut() {
|
|||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
const { medusaLogout } = await import('../../../features/medusa-storefront/src/lib/data/customer');
|
const { medusaLogout } = await import('../../../features/medusa-storefront/src/lib/data/customer');
|
||||||
await medusaLogout();
|
await medusaLogout(undefined, false);
|
||||||
} catch (medusaError) {
|
} catch (medusaError) {
|
||||||
console.warn('Medusa logout failed or not available:', medusaError);
|
console.warn('Medusa logout failed or not available:', medusaError);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user