-
Notifications
You must be signed in to change notification settings - Fork 0
/
api.ts
46 lines (34 loc) · 1.03 KB
/
api.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
import { EducationType } from "types/education";
import { ProjectType } from "types/project";
import { client } from "./client";
export const getProjects = async () => {
const projectQuery = `*[_type == "projects"] | order(finishedAt desc)`;
const projects = await client.fetch<ProjectType[]>(projectQuery);
return projects;
};
export const getResume = async () => {
const resumeQuery = `*[_type == "resume"][0]{
"documentUrl": document.asset->url
}`;
const resume = await client.fetch<{ documentUrl: string }>(resumeQuery);
return resume;
};
export const getEducationHistory = async () => {
const educationQuery = `*[_type == "education"] | order(start desc){
name,
image,
description,
start,
end
}`;
const educationHistory = await client.fetch<EducationType[]>(educationQuery);
return educationHistory;
};
export const getSkills = async () => {
const skillsQuery = `*[_type == "skills"]{
name,
image
}`;
const skills = await client.fetch<SkillType[]>(skillsQuery);
return skills;
};