mutation is returning void

I made a procedure that returns a string, but when I try to use it on my frontend, it's returning void instead of a string.
20 Replies
'tonyyprints'
'tonyyprints'OP•2y ago
the images below are the procedure
'tonyyprints'
'tonyyprints'OP•2y ago
'tonyyprints'
'tonyyprints'OP•2y ago
Brendonovich
Brendonovich•2y ago
When using mutate, you are expected to use the onSuccess and onError callbacks you can provide as a second argument. It won't wait for you to finish. The behaviour you want can be done with mutateAsync, which you'll have to await.
'tonyyprints'
'tonyyprints'OP•2y ago
anychance this is the same as you are talking about?
'tonyyprints'
'tonyyprints'OP•2y ago
I know this is for optimistic ui updates, but can I add onSuccess to that?
Brendonovich
Brendonovich•2y ago
Yeah that's it
'tonyyprints'
'tonyyprints'OP•2y ago
it still does the same thing when I do this
Brendonovich
Brendonovich•2y ago
You can do it either in useMutation or when you call mutate
'tonyyprints'
'tonyyprints'OP•2y ago
I still get the same issue even when I use this 😦
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Brendonovich
Brendonovich•2y ago
Show how you're using onSuccess
'tonyyprints'
'tonyyprints'OP•2y ago
sorry I'm a little novice to this working on adding this right now
'tonyyprints'
'tonyyprints'OP•2y ago
'tonyyprints'
'tonyyprints'OP•2y ago
my brain is not working anymore lmfao
Brendonovich
Brendonovich•2y ago
put all the stuff from the onSubmit into that function except for the initial mutation
'tonyyprints'
'tonyyprints'OP•2y ago
'tonyyprints'
'tonyyprints'OP•2y ago
like this stuff?
Brendonovich
Brendonovich•2y ago
yeah mutate doesn't return anything, you handle all the success/error logic in those callbacks
'tonyyprints'
'tonyyprints'OP•2y ago
Want results from more Discord servers?
Add your server