API Dashboard Admin Table JOB

This commit is contained in:
2025-02-06 17:31:09 +08:00
parent f27a900604
commit be318e7136
14 changed files with 809 additions and 487 deletions

View File

@@ -1,9 +1,10 @@
export {
apiGetJobStatusCountDashboard,
apiGetJobArsipCount
apiGetAdminJobStatusCountDashboard as apiGetJobStatusCountDashboard ,
apiGetAdminJobArsipCount as apiGetJobArsipCount,
apiGetAdminJobByStatus
}
const apiGetJobStatusCountDashboard = async ({ name }: {
const apiGetAdminJobStatusCountDashboard = async ({ name }: {
name: "Publish" | "Review" | "Reject";
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
@@ -21,7 +22,7 @@ const apiGetJobStatusCountDashboard = async ({ name }: {
return await response.json().catch(() => null)
}
const apiGetJobArsipCount = async () => {
const apiGetAdminJobArsipCount = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -36,4 +37,31 @@ const apiGetJobArsipCount = async () => {
});
return await response.json().catch(() => null)
};
};
const apiGetAdminJobByStatus = async ({
status,
page,
search
}: {
status: "Publish" | "Review" | "Reject";
page: string;
search: string;
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const response = await fetch(
`/api/admin/job/${status}${isPage}${isSearch}`,
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`
}
}
)
return await response.json().catch(() => null)
}