@kadconsulting/dry
Version:
KAD Reusable Component Library
25 lines • 837 B
JavaScript
// @ts-nocheck
import { useState, useEffect } from 'react';
import { fetchShopPageData } from '../api/fetchData';
export const useShopPageData = () => {
const [shopSections, setShopSections] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchShopData = async () => {
setLoading(true);
try {
const response = await fetchShopPageData();
setShopSections(response?.data?.attributes || null);
}
catch (error) {
console.error('Failed to fetch shop page data', error);
}
finally {
setLoading(false);
}
};
fetchShopData();
}, []);
return { shopSections, loading };
};
//# sourceMappingURL=useShopPageData.js.map