You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this code compiles and runs - but I don't see any onSuccess callback.
varmodel:UserLoginModel={}model.userName=usernamemodel.password=passwordawaitpostMutation.mutate(model,{onError: (error:any,variables:any,context:any)=>{// An error happened!console.log(`🔥 error ${error}`)},onSuccess: (data:any,variables:any,context:any)=>{console.log("🎸 data:",data)console.log("variables:",variables)console.log("context:",context)// let token = data.token// axiosInstance.defaults.headers.common.Authorization = `Bearer ${token}`;// Boom baby!},})
// here we are authenticated - but in the body of response - there's a token
the body - is by default undefined - so there's no token - auto populated...
console.log("🌱 success result:",postMutation)
console.log("🌱 success result:",postMutation.result.token ?? "") // FAILS - as the postMutation . data = undefined
This seems unrelated to Rapini. For general support for Tanstack please file issues in their repo. For axios issues file an issue in the axios repo. Thanks
is it possible to pass this into the given mutations?
wanting to do something like this.... at client level - without rewriting sdk
https://github.com/c121914yu/FastGPT/blob/8c70205940138c75e48fa648b927fafeea1f0e5a/src/hooks/useRequest.tsx
this runs / authenticates fine - but I need to save the token to add to auth header.
this code compiles and runs - but I don't see any onSuccess callback.
// here we are authenticated - but in the body of response - there's a token
the body - is by default undefined - so there's no token - auto populated...
console.log("🌱 success result:",postMutation)
console.log("🌱 success result:",postMutation.result.token ?? "") // FAILS - as the postMutation . data = undefined
🌱 success result: {"context": undefined, "data": undefined, "error": null, "failureCount": 0, "failureReason": null, "isError": false, "isIdle": true, "isLoading": false, "isPaused": false, "isSuccess": false, "mutate": [Function anonymous], "mutateAsync": [Function bound mutate], "reset": [Function bound reset], "status": "idle", "variables": undefined}
can tanstack be made to default to any - instead of undefined?
The text was updated successfully, but these errors were encountered: