fix ( upload & api )

deksripsi:
- fix upload image pada berita investasi
- fix api berita investasi
This commit is contained in:
2025-01-16 12:28:39 +08:00
parent cb0691c7f2
commit cdc8ff6d18
17 changed files with 502 additions and 241 deletions

View File

@@ -1,3 +1,4 @@
import { data } from "autoprefixer";
export const apiGetOneInvestasiById = async ({ id }: { id: string }) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -88,3 +89,29 @@ export const apiGetDokumenInvestasiById = async ({
);
return await response.json().catch(() => null);
};
export const apiGetBeritaInvestasiById = async ({
id,
kategori,
page,
}: {
id: string;
kategori?: undefined | "get-all";
page?: string;
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const onCategory = kategori ? `?kategori=${kategori}&page=${page}` : "";
const response = await fetch(`/api/new/investasi/berita/${id}${onCategory}`, {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
});
return await response.json().catch(() => null);
};