deskrispi:
- fix status job
This commit is contained in:
2025-02-19 16:22:34 +08:00
parent 758d4b4a9e
commit d474d7611b
15 changed files with 412 additions and 166 deletions

View File

@@ -0,0 +1,47 @@
export { apiGetJobByStatus };
const apiGetJobByStatus = async ({
status,
page,
}: {
status?: string;
page: string;
}) => {
try {
// Fetch token from cookie
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) {
console.error("No token found");
return null;
}
console.log("status > ", status);
// Send PUT request to update portfolio logo
const isPage = `?page=${page}`
const response = await fetch(`/api/job/status/${status}${isPage}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${token}`,
},
});
// Check if the response is OK
if (!response.ok) {
const errorData = await response.json().catch(() => null);
console.error(
"Error updating portfolio logo:",
errorData?.message || "Unknown error"
);
return null;
}
return await response.json();
} catch (error) {
console.error("Error updating portfolio medsos:", error);
throw error; // Re-throw the error to handle it in the calling function
}
};