fix job
deskripsi: - fix api job : detail > publish, review, reject, draft, arsip
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export { apiGetJobByStatus, apiGetJob, apiGetJobArsip };
|
||||
export { apiGetJobByStatus, apiGetJob, apiGetJobArsip, apiGetJobById };
|
||||
|
||||
const apiGetJobByStatus = async ({
|
||||
status,
|
||||
@@ -124,3 +124,40 @@ const apiGetJobArsip = async ({
|
||||
throw error; // Re-throw the error to handle it in the calling function
|
||||
}
|
||||
};
|
||||
|
||||
const apiGetJobById = async ({ id }: { id: 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;
|
||||
}
|
||||
|
||||
// Send PUT request to update portfolio logo
|
||||
const response = await fetch(`/api/job/${id}`, {
|
||||
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 logo:", error);
|
||||
throw error; // Re-throw the error to handle it in the calling function
|
||||
}
|
||||
};
|
||||
@@ -4,14 +4,11 @@ import {
|
||||
ComponentGlobal_CardStyles,
|
||||
ComponentGlobal_LoadImage,
|
||||
} from "@/app_modules/_global/component";
|
||||
import { Box, Center, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { Center, Stack, Text } from "@mantine/core";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
import { Job_SkeletonDetailJob } from "../skeleton/comp_skeleton_beranda";
|
||||
|
||||
export default function ComponentJob_DetailData({
|
||||
data,
|
||||
}: {
|
||||
data?: MODEL_JOB;
|
||||
}) {
|
||||
export default function ComponentJob_DetailData({ data }: { data: MODEL_JOB }) {
|
||||
return (
|
||||
<>
|
||||
{data ? (
|
||||
@@ -39,24 +36,7 @@ export default function ComponentJob_DetailData({
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
) : (
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack spacing={"xl"}>
|
||||
<Stack align="center">
|
||||
<Skeleton h={250} w={200} radius="md" />
|
||||
<Skeleton h={10} w={200} />
|
||||
</Stack>
|
||||
|
||||
{Array.from(new Array(2)).map((e, i) => (
|
||||
<Stack key={i}>
|
||||
<Skeleton h={10} w={100} />
|
||||
|
||||
{Array.from({ length: 3 }).map((_, ii) => (
|
||||
<Skeleton h={10} key={ii} />
|
||||
))}
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
<Job_SkeletonDetailJob />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -2,7 +2,7 @@ import Job_ComponentButtonSaveCreate from "./button/comp_button_save_create";
|
||||
import { Job_ComponentButtonUpdateBeranda } from "./button/comp_button_update_beranda";
|
||||
import { Job_ComponentButtonUpdateData } from "./button/comp_button_update_data";
|
||||
import { Job_ComponentBoxUploadImage } from "./detail/comp_box_upload_image";
|
||||
import Job_ComponentSkeletonBeranda from "./skeleton/comp_skeleton_beranda";
|
||||
import { Job_ComponentSkeletonBeranda } from "./skeleton/comp_skeleton_beranda";
|
||||
|
||||
export { Job_ComponentButtonSaveCreate };
|
||||
export { Job_ComponentBoxUploadImage };
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { ComponentGlobal_CardStyles } from "@/app_modules/_global/component";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { Box, Center, Group, Skeleton, Stack } from "@mantine/core";
|
||||
import { Box, Center, Group, Stack } from "@mantine/core";
|
||||
|
||||
export default function Job_ComponentSkeletonBeranda() {
|
||||
export {
|
||||
Job_ComponentSkeletonBeranda,
|
||||
Job_SkeletonDetailJob,
|
||||
Job_SkeletonEdit
|
||||
};
|
||||
|
||||
function Job_ComponentSkeletonBeranda() {
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
@@ -24,3 +30,43 @@ export default function Job_ComponentSkeletonBeranda() {
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Job_SkeletonDetailJob() {
|
||||
return (
|
||||
<>
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack spacing={"xl"}>
|
||||
<Stack align="center">
|
||||
<CustomSkeleton h={250} w={200} radius="md" />
|
||||
<CustomSkeleton h={10} w={200} />
|
||||
</Stack>
|
||||
|
||||
{Array.from(new Array(2)).map((e, i) => (
|
||||
<Stack key={i}>
|
||||
<CustomSkeleton h={10} w={100} />
|
||||
|
||||
{Array.from({ length: 3 }).map((_, ii) => (
|
||||
<CustomSkeleton h={10} key={ii} />
|
||||
))}
|
||||
</Stack>
|
||||
))}
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Job_SkeletonEdit() {
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
<CustomSkeleton height={300} width={"100%"} />
|
||||
<Center>
|
||||
<CustomSkeleton height={40} radius={"xl"} width={"50%"} />
|
||||
</Center>
|
||||
<CustomSkeleton height={500} width={"100%"} />
|
||||
<CustomSkeleton height={40} radius={"xl"} width={"100%"} />
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user