forked from imbytecat/fullstack-starter
31 lines
813 B
TypeScript
31 lines
813 B
TypeScript
import { createTanstackQueryUtils } from '@orpc/tanstack-query'
|
|
import { orpc as orpcClient } from './orpc'
|
|
|
|
export const orpc = createTanstackQueryUtils(orpcClient, {
|
|
experimental_defaults: {
|
|
todo: {
|
|
create: {
|
|
mutationOptions: {
|
|
onSuccess: (_, __, ___, ctx) => {
|
|
ctx.client.invalidateQueries({ queryKey: orpc.todo.list.key() })
|
|
},
|
|
},
|
|
},
|
|
update: {
|
|
mutationOptions: {
|
|
onSuccess: (_, __, ___, ctx) => {
|
|
ctx.client.invalidateQueries({ queryKey: orpc.todo.list.key() })
|
|
},
|
|
},
|
|
},
|
|
remove: {
|
|
mutationOptions: {
|
|
onSuccess: (_, __, ___, ctx) => {
|
|
ctx.client.invalidateQueries({ queryKey: orpc.todo.list.key() })
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|