fix: Update js-sdk with token (#10211)

This commit is contained in:
Oli Juhl
2024-11-22 09:32:48 +01:00
committed by GitHub
parent 44265a928d
commit 1efe4e9e33
3 changed files with 41 additions and 37 deletions

View File

@@ -58,11 +58,12 @@ export const useLogout = (options?: UseMutationOptions<void, FetchError>) => {
}
export const useUpdateProviderForEmailPass = (
token: string,
options?: UseMutationOptions<void, FetchError, { password: string }>
) => {
return useMutation({
mutationFn: (payload) =>
sdk.auth.updateProvider("user", "emailpass", payload),
sdk.auth.updateProvider("user", "emailpass", payload, token),
onSuccess: async (data, variables, context) => {
options?.onSuccess?.(data, variables, context)
},

View File

@@ -114,7 +114,7 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
},
})
const { mutateAsync, isPending } = useUpdateProviderForEmailPass()
const { mutateAsync, isPending } = useUpdateProviderForEmailPass(token)
const handleSubmit = form.handleSubmit(async ({ password }) => {
if (!invite) {
@@ -123,7 +123,6 @@ const ChooseNewPassword = ({ token }: { token: string }) => {
await mutateAsync(
{
email: invite.entity_id,
password,
},
{