fix ( authorization api )
deskripsi: - memberi authorizetion ke api/new/*
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export const apiGetPortofolioByProfile = async (path?: string) => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return null;
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/portofolio${path ? path : ""}`, {
|
||||
headers: {
|
||||
@@ -18,7 +18,7 @@ export const apiGetPortofolioByProfile = async (path?: string) => {
|
||||
|
||||
export const apiGetOnePortofolioById = async (path: string, cat: string) => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return null;
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/portofolio/${path}?cat=${cat}`, {
|
||||
headers: {
|
||||
@@ -36,7 +36,7 @@ export const apiGetOnePortofolioById = async (path: string, cat: string) => {
|
||||
|
||||
export const apiDeletePortofolio = async (path: string) => {
|
||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||
if (!token) return null;
|
||||
if (!token) return await token.json().catch(() => null);
|
||||
|
||||
const response = await fetch(`/api/new/portofolio/${path}`, {
|
||||
method: "DELETE",
|
||||
@@ -46,6 +46,5 @@ export const apiDeletePortofolio = async (path: string) => {
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user