-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
22 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,11 @@ | ||
import { createClient, QueryParams } from "next-sanity"; | ||
import { createClient } from "next-sanity"; | ||
import { apiVersion, dataset, projectId, studioUrl } from "../env"; | ||
|
||
export const client = createClient({ | ||
projectId, | ||
dataset, | ||
apiVersion, | ||
useCdn: true, | ||
perspective: "published", | ||
stega: { studioUrl }, | ||
}); | ||
|
||
export async function sanityFetchNonLive<const QueryString extends string>({ | ||
query, | ||
params = {}, | ||
revalidate = 60, // default revalidation time in seconds | ||
tags = [], | ||
}: { | ||
query: QueryString; | ||
params?: QueryParams; | ||
revalidate?: number | false; | ||
tags?: string[]; | ||
}) { | ||
return client.fetch(query, params, { | ||
next: { | ||
revalidate: tags.length ? false : revalidate, // for simple, time-based revalidation | ||
tags, // for tag-based revalidation | ||
}, | ||
}); | ||
} |