change name action for api
This commit is contained in:
@@ -10,10 +10,13 @@ export const BASE_API_URL = DEV + getConfigValue("enterfront.api");
|
||||
// fetch(`${BASE_API_URL}/books/list`)
|
||||
|
||||
export async function post(path, body) {
|
||||
const token = localStorage.getItem('token');
|
||||
|
||||
const res = await fetch(`${BASE_API_URL}${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": token ? `Bearer ${token}` : undefined
|
||||
},
|
||||
body: JSON.stringify(body)
|
||||
});
|
||||
@@ -32,8 +35,13 @@ export async function post(path, body) {
|
||||
}
|
||||
|
||||
export async function get(path){
|
||||
const token = localStorage.getItem('token');
|
||||
|
||||
const res = await fetch(`${BASE_API_URL}${path}`, {
|
||||
method: "GET"
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Authorization": token ? `Bearer ${token}` : undefined
|
||||
}
|
||||
});
|
||||
|
||||
if (res.status === 200) {
|
||||
|
||||
Reference in New Issue
Block a user