cart checker for remove cart when slug changed

This commit is contained in:
hamid zarghami
2025-12-29 09:04:58 +03:30
parent d6c2f2630d
commit 98b834b982
5 changed files with 65 additions and 7 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ import React from 'react'
import type { Metadata, Viewport } from 'next'
import { getRestaurant } from './lib/getRestaurant'
import { notFound } from 'next/navigation'
import CartChecker from '@/components/CartChecker'
export const dynamic = 'force-dynamic'
export const revalidate = 0
@@ -85,7 +86,10 @@ export default async function Layout({
try {
const { name } = await params
await getRestaurant(name)
return <PreferenceWrapper>{children}</PreferenceWrapper>
return <>
<PreferenceWrapper>{children}</PreferenceWrapper>
<CartChecker />
</>
} catch (error) {
if (error instanceof Error && error.message === 'RESTAURANT_NOT_FOUND') {
notFound()