How do I pass query params from UpdatePasswordPage to updatePassword function in authProvider
How do I pass query params from UpdatePasswordPage to updatePassword function in authProvider?
message.txt4.72KB
authProvider can take query parameters as arguments from the URL. If we assume that the URL is ,> the method will get the mutation's parameters as arguments and the token query parameter as well.authProvider:password, , and token properties. The token property is the query parameter from the URL.updatePasswordupdatePasswordupdatePasswordupdatePassword<http://localhost:3000/reset-password?token=123confirmPasswordconst authProvider: AuthProvider = {
// ---
updatePassword: async ({ password, confirmPassword, token }) => {
console.log(token); // 123
// if request is successful
return {
success: true,
redirectTo: "/login",
};
},
};const { mutate: updatePassword } = useUpdatePassword<any>();
updatePassword({
redirectPath: "/custom-url",
query: "?foo=bar",
}); updatePassword: async (params) => {
console.log(params); // { redirectPath: "/custom-url", query: "?foo=bar" }
return {
success: true,
};
},