Function
useBridgeMutation
(
mutationFn: MutationFunction<
{ data: TData; error: undefined } | { data: undefined; error: TError },
TVariables
>,
options?: Omit<
UseMutationOptions<Exclude<TData, undefined>, Exclude<TError, undefined>, TVariables, TContext>,
'mutationFn'
>,
)
Source from the content-addressed store, hash-verified
| 39 | ); |
| 40 | |
| 41 | const useBridgeMutation = <TData, TError, TVariables = void, TContext = any>( |
| 42 | mutationFn: MutationFunction< |
| 43 | { data: TData; error: undefined } | { data: undefined; error: TError }, |
| 44 | TVariables |
| 45 | >, |
| 46 | options?: Omit< |
| 47 | UseMutationOptions<Exclude<TData, undefined>, Exclude<TError, undefined>, TVariables, TContext>, |
| 48 | 'mutationFn' |
| 49 | >, |
| 50 | ) => |
| 51 | useMutation(async (input: TVariables) => { |
| 52 | const { data, error } = await mutationFn(input); |
| 53 | if (error) throw error; |
| 54 | return data as Exclude<TData, undefined>; |
| 55 | }, options); |
| 56 | |
| 57 | export * from '@tanstack/react-query'; |
| 58 | export { useBridgeQuery, useBridgeMutation }; |
Tested by
no test coverage detected