MCPcopy Index your code
hub / github.com/TanStack/router / mutate

Function mutate

e2e/solid-start/basic-auth/src/hooks/useMutation.ts:15–31  ·  view source on GitHub ↗
(variables: TVariables)

Source from the content-addressed store, hash-verified

13 >('idle')
14
15 const mutate = async (variables: TVariables): Promise<TData | undefined> => {
16 setStatus('pending')
17 setSubmittedAt(Date.now())
18 setVariables(variables as any)
19 //
20 try {
21 const data = await opts.fn(variables)
22 await opts.onSuccess?.({ data })
23 setStatus('success')
24 setError(undefined)
25 setData(data as any)
26 return data
27 } catch (err: any) {
28 setStatus('error')
29 setError(err)
30 }
31 }
32
33 return {
34 status,

Callers

nothing calls this directly

Calls 1

onSuccessMethod · 0.80

Tested by

no test coverage detected