This commit is contained in:
2025-02-11 10:42:00 +08:00
parent a1405e301b
commit 2c443587ba
9 changed files with 487 additions and 128 deletions

View File

@@ -1,5 +1,7 @@
export {
apiGetAdminCollaborationStatusCountDashboard,
apiGetAdminCollaborationStatusById,
apiGetAdminCollaborationRoomById
}
const apiGetAdminCollaborationStatusCountDashboard = async ({
@@ -23,3 +25,47 @@ const apiGetAdminCollaborationStatusCountDashboard = async ({
// console.log("Ini Response", await response.json());
return await response.json().catch(() => null);
}
const apiGetAdminCollaborationStatusById = async ({ status, page, search }: {
status: "Publish" | "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/collaboration/${status}${isPage}${isSearch}`, {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
}
})
return await response.json().catch(() => null);
}
const apiGetAdminCollaborationRoomById = async ({ page, search }: {
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/collaboration/group${isPage}${isSearch}`, {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
}
})
return await response.json().catch(() => null);
}