import { useContext, use } from "react"; import { ConfigContext } from "@/providers/ConfigProvider"; export function useStore(){ const context = useContext(ConfigContext); if(!context){ throw new Error( "useConfig must be used inside ConfigProvider" ); } const {store} = context.config; return { store, setCurrentCurrency: context.setCurrentCurrency }; } export function useCountries() { const context = useContext(ConfigContext); if (!context) { throw new Error( "useCountries must be used within ConfigProvider", ); } return use(context.config.countriesPromise); } export function useCurrencyList() { const context = useContext(ConfigContext); if (!context) { throw new Error( "useCurrencyList must be used within ConfigProvider", ); } return use(context.config.currenciesPromise); }