diff --git a/src/backend/api.js b/src/backend/api.js index d9d5199..a28405a 100644 --- a/src/backend/api.js +++ b/src/backend/api.js @@ -5,7 +5,7 @@ const LOCAL = "http://localhost:8099"; const DEV = "https://dev.bro-js.ru"; 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`) @@ -21,18 +21,18 @@ export async function post(path, body) { body: JSON.stringify(body) }); - console.log('Data from API:', res); + const data = JSON.parse(await res.text()); + + console.log("Data from API:", data) if (res.status === 200) { - const data = await res.json(); console.log("Received post:", data); return {ok: true, data: data}; } else { - const errorData = await res.json(); - console.log("Error during post:", errorData.message); + console.log("Error during post:", data.message); - return {ok: false, data: errorData}; + return {ok: false, data: data}; } }