mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-24 16:49:48 +00:00
chore: Refactoring all import directories to alias and all .js|.jsx renamed to be .ts|.tsx
This commit is contained in:
23
src/containers/Preferences/Currencies/CurrenciesProvider.tsx
Normal file
23
src/containers/Preferences/Currencies/CurrenciesProvider.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { useCurrencies } from '@/hooks/query';
|
||||
|
||||
const CurrenciesContext = createContext();
|
||||
|
||||
/**
|
||||
* currencies provider.
|
||||
*/
|
||||
function CurrenciesProvider({ ...props }) {
|
||||
// fetches the currencies list.
|
||||
const { data: currencies, isLoading: isCurrenciesLoading } = useCurrencies();
|
||||
|
||||
const state = {
|
||||
currencies,
|
||||
isCurrenciesLoading,
|
||||
};
|
||||
|
||||
return <CurrenciesContext.Provider value={state} {...props} />;
|
||||
}
|
||||
|
||||
const useCurrenciesContext = () => useContext(CurrenciesContext);
|
||||
|
||||
export { CurrenciesProvider, useCurrenciesContext };
|
||||
Reference in New Issue
Block a user