From bfff5d305a1e899f7e7d8bcafdb8446d24f1744a Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 25 Oct 2023 23:59:37 -0300 Subject: [PATCH] refactor(storeContext.tsx): update setHasStore to use "enabled" property from response instead of "has_store" for better readability and consistency refactor(API/index.ts): update checkHasStore API endpoint URL to use BASE_URL_API constant for better maintainability and consistency --- src/frontend/src/contexts/storeContext.tsx | 2 +- src/frontend/src/controllers/API/index.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/contexts/storeContext.tsx b/src/frontend/src/contexts/storeContext.tsx index b02ed072f..77ca8bc81 100644 --- a/src/frontend/src/contexts/storeContext.tsx +++ b/src/frontend/src/contexts/storeContext.tsx @@ -18,7 +18,7 @@ export function StoreProvider({ children }) { const [hasStore, setHasStore] = useState(false); checkHasStore().then((res) => { - setHasStore(res[0].has_store); + setHasStore(res["enabled"]); }); return ( diff --git a/src/frontend/src/controllers/API/index.ts b/src/frontend/src/controllers/API/index.ts index b6c7240b8..e0aceb9cd 100644 --- a/src/frontend/src/controllers/API/index.ts +++ b/src/frontend/src/controllers/API/index.ts @@ -679,9 +679,7 @@ export async function searchComponent( export async function checkHasStore() { try { - const res = await api.get( - `https://65384701a543859d1bb15e63.mockapi.io/Store` - ); + const res = await api.get(`${BASE_URL_API}store`); if (res.status === 200) { return res.data; }