1- import { useQuery } from '@tanstack/react-query' ;
2- import { ExtractFnReturnType , QueryConfig } from 'src/lib/react-query' ;
3- import { RemoteConfig } from "../types" ;
4- import { axios } from 'src/lib/axios' ;
5- import { useRemoteConfigStore } from " ../stores/remoteConfig" ;
1+ import { useQuery } from '@tanstack/react-query'
2+ import { axios } from 'src/lib/axios'
3+ import { ExtractFnReturnType , QueryConfig } from 'src/lib/react-query'
4+ import { useRemoteConfigStore } from '../stores/remoteConfig'
5+ import { RemoteConfig } from ' ../types'
66
77const getRemoteConfig = async ( ) : Promise < RemoteConfig > => {
8- return axios . get ( '/data/remoteConfiguration.json' ) ;
8+ return axios . get ( '/data/remoteConfiguration.json' )
99}
1010
11- type QueryFnType = typeof getRemoteConfig ;
11+ type QueryFnType = typeof getRemoteConfig
1212
1313type UseGetRemoteConfigOptions = {
14- config ?: QueryConfig < QueryFnType > ;
15- } ;
14+ config ?: QueryConfig < QueryFnType >
15+ }
1616export const useGetRemoteConfig = ( { config } : UseGetRemoteConfigOptions = { } ) => {
1717 return useQuery < ExtractFnReturnType < QueryFnType > > ( {
1818 onSuccess ( remoteConfig ) {
19- useRemoteConfigStore . getState ( ) . setRemoteConfig ( remoteConfig ) ;
19+ useRemoteConfigStore . getState ( ) . setRemoteConfig ( remoteConfig )
2020 } ,
2121 ...config ,
2222 queryKey : [ 'remote-config' ] ,
2323 queryFn : ( ) => getRemoteConfig ( ) ,
24- } ) ;
25- }
24+ } )
25+ }
0 commit comments