fix: collaboration

deskripsi:
- fix: use server pada create dan edit menjadi API
This commit is contained in:
2025-05-26 17:15:46 +08:00
parent b9db3f6e02
commit 5007827d51
10 changed files with 231 additions and 141 deletions

View File

@@ -4,6 +4,7 @@ export {
apiGetMasterStatusTransaksi,
apiGetAdminContact,
apiGetMasterEmotions,
apiGetMasterIndustri,
};
const apiGetMasterBank = async () => {
@@ -108,3 +109,37 @@ const apiGetMasterEmotions = async () => {
return await response.json().catch(() => null);
};
const apiGetMasterIndustri = async () => {
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;
}
const response = await fetch(`/api/master/industri`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${token}`,
},
});
if (!response.ok) {
const errorData = await response.json().catch(() => null);
console.error(
"Error get master industri:",
errorData?.message || "Unknown error"
);
return null;
}
return await response.json();
} catch (error) {
console.error("Error get master industri:", error);
throw error;
}
};