Add API Dashboard Forum & Job
This commit is contained in:
39
src/app_modules/admin/job/lib/api_fetch_admin_job.ts
Normal file
39
src/app_modules/admin/job/lib/api_fetch_admin_job.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
export {
|
||||
apiGetJobStatusCountDashboard,
|
||||
apiGetJobArsipCount
|
||||
}
|
||||
|
||||
const apiGetJobStatusCountDashboard = 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/job/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 apiGetJobArsipCount = 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/job/dashboard/arsip`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
}
|
||||
});
|
||||
return await response.json().catch(() => null)
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user