mirror of
https://github.com/vercel/commerce.git
synced 2025-05-14 21:47:51 +00:00
Update revalidate function
This commit is contained in:
parent
20caffdce3
commit
93ba85fbf5
@ -43,12 +43,12 @@ export async function POST(req: NextRequest) {
|
|||||||
return new Response('Bad Request', { status: 400 })
|
return new Response('Bad Request', { status: 400 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(body)
|
||||||
|
|
||||||
revalidateTag(body._type)
|
revalidateTag(body._type)
|
||||||
|
|
||||||
if (body.slug) {
|
if (body.slug) {
|
||||||
revalidateTag(`${body._type}:${body.slug}`)
|
revalidateTag(`${body._type}:${body.slug}`)
|
||||||
} else {
|
|
||||||
revalidateTag(`${body._type}`)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
|
@ -96,7 +96,7 @@ export function getMainMenu(locale: string) {
|
|||||||
return sanityFetch<MainMenuPayload | null>({
|
return sanityFetch<MainMenuPayload | null>({
|
||||||
query: mainMenuQuery,
|
query: mainMenuQuery,
|
||||||
params: { locale },
|
params: { locale },
|
||||||
tags: ['menu'],
|
tags: ['category'],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +104,6 @@ export function getFooterMenus(locale: string) {
|
|||||||
return sanityFetch<FooterMenusPayload | null>({
|
return sanityFetch<FooterMenusPayload | null>({
|
||||||
query: footerMenusQuery,
|
query: footerMenusQuery,
|
||||||
params: { locale },
|
params: { locale },
|
||||||
tags: ['menu'],
|
tags: ['footerMenu'],
|
||||||
})
|
})
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user