File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1
- import { createORPCClient } from '@orpc/client' ;
1
+ import { createORPCClient , onError , ORPCError } from '@orpc/client' ;
2
2
import { RPCLink } from '@orpc/client/fetch' ;
3
3
import { createORPCReactQueryUtils } from '@orpc/react-query' ;
4
4
import type { RouterClient } from '@orpc/server' ;
5
5
6
6
import { envClient } from '@/env/client' ;
7
+ import { openDemoModeDrawer } from '@/features/demo-mode/demo-mode-drawer' ;
7
8
8
9
import type { Router } from './types' ;
9
10
10
11
const link = new RPCLink ( {
11
12
url : `${ envClient . VITE_BASE_URL } /api/rpc` ,
13
+ interceptors : [
14
+ onError ( ( error ) => {
15
+ if ( error instanceof ORPCError && error . message === 'DEMO_MODE_ENABLED' ) {
16
+ openDemoModeDrawer ( ) ;
17
+ }
18
+ } ) ,
19
+ ] ,
12
20
} ) ;
13
21
14
22
const orpcClient : RouterClient < Router > = createORPCClient ( link ) ;
Original file line number Diff line number Diff line change 1
- import { ORPCError } from '@orpc/client' ;
2
- import { MutationCache , QueryClient } from '@tanstack/react-query' ;
3
-
4
- import { openDemoModeDrawer } from '@/features/demo-mode/demo-mode-drawer' ;
1
+ import { QueryClient } from '@tanstack/react-query' ;
5
2
6
3
const networkMode = import . meta. dev ? 'always' : undefined ;
7
4
@@ -14,11 +11,4 @@ export const queryClient = new QueryClient({
14
11
networkMode,
15
12
} ,
16
13
} ,
17
- mutationCache : new MutationCache ( {
18
- onError : ( error ) => {
19
- if ( error instanceof ORPCError && error . message === 'DEMO_MODE_ENABLED' ) {
20
- openDemoModeDrawer ( ) ;
21
- }
22
- } ,
23
- } ) ,
24
14
} ) ;
You can’t perform that action at this time.
0 commit comments