init for chats and api
This commit is contained in:
@@ -2,10 +2,10 @@ import {getConfigValue} from "@brojs/cli";
|
||||
|
||||
|
||||
const LOCAL = "http://localhost:8099";
|
||||
const DEV = "https://dev.bro-js.ru";
|
||||
const DEV = "https://dev.bro-js.ru/enterfront";
|
||||
const SERVER = "";
|
||||
|
||||
export const BASE_API_URL = DEV + getConfigValue("enterfront.api");
|
||||
export const BASE_API_URL = LOCAL + getConfigValue("enterfront.api");
|
||||
|
||||
// fetch(`${BASE_API_URL}/books/list`)
|
||||
|
||||
@@ -51,15 +51,15 @@ export async function get(path){
|
||||
}
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (res.status === 200) {
|
||||
const data = await res.json();
|
||||
console.log("Received get:", data);
|
||||
|
||||
return {ok: true, data: data};
|
||||
} else {
|
||||
const errorData = await res.json();
|
||||
console.log("Error during get:", errorData.message);
|
||||
console.log("Error during get:", data.message);
|
||||
|
||||
return {ok: false, data: errorData};
|
||||
return {ok: false, data: data};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user