-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathrating.ts
More file actions
34 lines (27 loc) · 830 Bytes
/
rating.ts
File metadata and controls
34 lines (27 loc) · 830 Bytes
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
export const useUnratedWebinars = () => useState("unratedWebinars", () => []);
export async function getUnratedWebinars() {
try {
const response = await GET(`/events/unrated`);
const unratedWebinars = useUnratedWebinars();
unratedWebinars.value = response ?? [];
return [response, null];
} catch (error: any) {
return [null, error.data];
}
}
export async function submitWebinarRating(id: string, rating: number) {
try {
const response = await POST(`/events/rate/${id}`, <any>{ rating });
return [response, null];
} catch (error: any) {
return [null, error.data];
}
}
export async function cancelWebinarRating(id: string) {
try {
const response = await DELETE(`/events/rate/${id}`);
return [response, null];
} catch (error: any) {
return [null, error.data];
}
}