-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsanity.query.ts
64 lines (60 loc) · 1.13 KB
/
sanity.query.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { groq } from "next-sanity";
import client from "./sanity.client";
export async function getProfile() {
return client.fetch(
groq`*[_type == "profile"]{
_id,
fullName,
headline,
profileImage {
alt,
"image": asset->url
},
shortBio,
location,
fullBio,
email,
"resumeURL": resumeURL.asset->url,
socialLinks,
skills
}`
);
}
export async function getJob() {
return client.fetch(
groq`*[_type == "job"]{
_id,
name,
jobTitle,
"logo": logo.asset->url,
url,
description,
startDate,
endDate,
}`
);
}
export async function getProjects() {
return client.fetch(
groq`*[_type == "project"]{
_id,
name,
"slug": slug.current,
tagline,
"logo": logo.asset->url,
}`
);
}
export async function getSingleProject(slug: string) {
return client.fetch(
groq`*[_type == "project" && slug.current == $slug][0]{
_id,
name,
projectUrl,
coverImage { alt, "image": asset->url },
tagline,
description
}`,
{ slug }
);
}