init for chats and api

This commit is contained in:
Nikolai Petukhov
2024-10-04 00:06:44 +03:00
parent 1301c145e8
commit 073c61977f
6 changed files with 441 additions and 13 deletions

View File

@@ -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};
}
}