fix ( upload & api )
deksripsi: - fix upload image pada berita investasi - fix api berita investasi
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user