mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 16:07:01 +00:00
Added preview functionality for home page
This commit is contained in:
parent
bfdfeeaf97
commit
e567914192
@ -1,4 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// Once rollup supports 'use client' module directives then 'next-sanity' will include them and this re-export will no longer be necessary
|
|
||||||
export { PreviewSuspense as default } from 'next-sanity/preview';
|
|
@ -1,20 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { definePreview } from "next-sanity/preview";
|
|
||||||
import { dataset, projectId } from "./sanity.client";
|
|
||||||
|
|
||||||
function onPublicAccessOnly() {
|
|
||||||
throw new Error("Unable to load preview as you're not logged in");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!projectId || !dataset) {
|
|
||||||
throw new Error(
|
|
||||||
"Missing projectId or dataset. Check your sanity.json or .env"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const usePreview = definePreview({
|
|
||||||
projectId,
|
|
||||||
dataset,
|
|
||||||
onPublicAccessOnly,
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user