fix ( authorization api )
deskripsi: - memberi authorizetion ke api/new/*
This commit is contained in:
@@ -1,19 +1,64 @@
|
||||
export const apiGetMasterInvestasi = async (path?: string) => {
|
||||
const response = await fetch(`/api/new/investasi/master${(path) ? path : ''}`)
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/investasi/master${path ? path : ""}`, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
export const apiGetOneInvestasiById = async (path: string) => {
|
||||
const response = await fetch(`/api/new/investasi/${path}`)
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/investasi/${path}`, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
export const apiGetAllInvestasi = async (path?: string) => {
|
||||
const response = await fetch(`/api/new/investasi${(path) ? path : ''}`)
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/investasi${path ? path : ""}`, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
export const apiGetAllSahamSaya = async (path?: string) => {
|
||||
const response = await fetch(`/api/new/investasi/invoice${(path) ? path : ''}`)
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(
|
||||
`/api/new/investasi/invoice${path ? path : ""}`,
|
||||
{
|
||||
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