Add API Dashboard ADMIN Doasi, Job, dan Voting

This commit is contained in:
2025-01-31 17:48:35 +08:00
parent 7e7856c32a
commit d2a1f85ec0
15 changed files with 443 additions and 53 deletions

View File

@@ -0,0 +1,36 @@
export {
apiGetVoteStatusCountDashboard,
apiGetVoteRiwayatCount
}
const apiGetVoteStatusCountDashboard = async ({ name }: {
name: "Publish" | "Review" | "Reject";
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const response = await fetch(`/api/admin/voting/dashboard/${name}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
}
});
return await response.json().catch(() => null);
}
const apiGetVoteRiwayatCount = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const response = await fetch(`/api/admin/voting/dashboard/riwayat`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
}
});
return await response.json().catch(() => null);
}