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
This commit is contained in:
cristhianzl 2023-10-25 23:59:37 -03:00
commit bfff5d305a
2 changed files with 2 additions and 4 deletions

View file

@ -18,7 +18,7 @@ export function StoreProvider({ children }) {
const [hasStore, setHasStore] = useState(false); const [hasStore, setHasStore] = useState(false);
checkHasStore().then((res) => { checkHasStore().then((res) => {
setHasStore(res[0].has_store); setHasStore(res["enabled"]);
}); });
return ( return (

View file

@ -679,9 +679,7 @@ export async function searchComponent(
export async function checkHasStore() { export async function checkHasStore() {
try { try {
const res = await api.get( const res = await api.get(`${BASE_URL_API}store`);
`https://65384701a543859d1bb15e63.mockapi.io/Store`
);
if (res.status === 200) { if (res.status === 200) {
return res.data; return res.data;
} }