File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
playground/src/pages/users Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
useIsMutating ,
11
11
useIsFetching ,
12
12
useMutationState ,
13
+ useMutation ,
13
14
} from ' @tanstack/vue-query'
14
15
15
16
const route = useRoute (' /users/[id]' )
@@ -61,6 +62,19 @@ const {
61
62
refetchOnMount: false ,
62
63
enabled ,
63
64
})
65
+
66
+ const {
67
+ data,
68
+ error,
69
+ mutate,
70
+ status : mutSate,
71
+ } = useMutation ({
72
+ mutationKey: [' hey' ],
73
+ mutationFn : async (id : number ) => {
74
+ await delay (500 )
75
+ return ' hey'
76
+ },
77
+ })
64
78
</script >
65
79
66
80
<template >
@@ -73,6 +87,15 @@ const {
73
87
Enabled
74
88
</label >
75
89
90
+ <pre >
91
+ Mutation
92
+ {{ data }}
93
+ {{ error }}
94
+ {{ mutSate }}
95
+ </pre >
96
+
97
+ <button @click =" mutate(2)" >Mutate</button >
98
+
76
99
<fieldset >
77
100
<legend >Controls</legend >
78
101
You can’t perform that action at this time.
0 commit comments