fix ( authorization api )
deskripsi: - memberi authorizetion ke api/new/*
This commit is contained in:
@@ -14,7 +14,17 @@ export const apiGetAllMap = async (path?: string) => {
|
||||
};
|
||||
|
||||
export const apiGetOneMapById = async (path: string) => {
|
||||
|
||||
const response = await fetch(`/api/new/map/${path}`);
|
||||
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/map/${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