@@ -6,6 +6,7 @@ import 'dayjs/locale/sv';
66import React , { useEffect , useState } from 'react' ;
77import { useNuiEvent } from 'react-fivem-hooks' ;
88import { useTranslation } from 'react-i18next' ;
9+ import { useAtom } from 'jotai' ;
910import { Route } from 'react-router-dom' ;
1011import './App.css' ;
1112import { useConfig } from './hooks/useConfig' ;
@@ -22,6 +23,8 @@ import { NUIEvents, UserEvents } from '@typings/Events';
2223import Deposit from './views/Deposit/Deposit' ;
2324import { fetchNui } from '@utils/fetchNui' ;
2425import Withdraw from './views/Withdraw/Withdraw' ;
26+ import { accountsAtom } from '@data/accounts' ;
27+ import { transactionBaseAtom } from '@data/transactions' ;
2528
2629dayjs . extend ( updateLocale ) ;
2730
@@ -47,9 +50,15 @@ const Content = styled.div`
4750const App : React . FC = ( ) => {
4851 const config = useConfig ( ) ;
4952 const [ hasLoaded , setHasLoaded ] = useState ( process . env . NODE_ENV === 'development' ) ;
53+ const [ , updateAccounts ] = useAtom ( accountsAtom ) ;
54+ const [ , updateTransactions ] = useAtom ( transactionBaseAtom ) ;
5055 useNuiEvent ( {
5156 event : UserEvents . Loaded ,
52- callback : ( ) => setHasLoaded ( true ) ,
57+ callback : ( ) => {
58+ setHasLoaded ( true ) ;
59+ updateAccounts ( ) ;
60+ updateTransactions ( ) ;
61+ } ,
5362 } ) ;
5463
5564 useNuiEvent ( { event : UserEvents . Unloaded , callback : ( ) => setHasLoaded ( false ) } ) ;
0 commit comments