-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsanity.client.ts
40 lines (33 loc) · 1.14 KB
/
sanity.client.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { createClient } from "next-sanity";
import { env } from "./env";
import {
About,
Home,
Podcast,
Partner,
Settings,
Services,
aboutQuery,
servicesQuery,
homeQuery,
podcastQuery,
partnersQuery,
settingsQuery,
} from "./sanity.queries";
export const client = createClient({
projectId: env.NEXT_PUBLIC_SANITY_PROJECT_ID,
dataset: env.NEXT_PUBLIC_SANITY_DATASET,
apiVersion: "2023-06-21",
/**
* @note If you set this to true the client will fetch content from our cache delivery network. In this case, however, we will not generate a whole lot of API traffic, and we want updates to be instantly available, so set this to false
*/
useCdn: false,
studioUrl: "/",
fetch: { next: { revalidate: 0 } },
});
export const getSettings = () => client.fetch<Settings>(settingsQuery);
export const getPartners = () => client.fetch<Partner[]>(partnersQuery);
export const getHome = () => client.fetch<Home>(homeQuery);
export const getAbout = () => client.fetch<About>(aboutQuery);
export const getPodcast = () => client.fetch<Podcast>(podcastQuery);
export const getServices = () => client.fetch<Services>(servicesQuery);