-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppHoc.tsx
44 lines (40 loc) · 1.03 KB
/
AppHoc.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';
import { RecoilRoot } from 'recoil';
import {
MutationCache,
QueryCache,
QueryClient,
QueryClientProvider,
} from 'react-query';
import axios from 'axios';
import App from './App';
import { NavigationContainer } from '@react-navigation/native';
const AppHoc = () => {
// * react query 글로벌 에러 핸들링 세팅
const queryClient = new QueryClient({
queryCache: new QueryCache({
onError: error => {
if (axios.isAxiosError(error) && error.response) {
console.log(JSON.stringify(error.response.data));
}
},
}),
mutationCache: new MutationCache({
onError: error => {
if (axios.isAxiosError(error) && error.response) {
console.log(JSON.stringify(error.response.data));
}
},
}),
});
return (
<QueryClientProvider client={queryClient}>
<RecoilRoot>
<NavigationContainer>
<App />
</NavigationContainer>
</RecoilRoot>
</QueryClientProvider>
);
};
export default AppHoc;