mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 04:33:11 +00:00
15 lines
639 B
TypeScript
15 lines
639 B
TypeScript
import { useMutation, type UseMutationResult } from "@tanstack/react-query";
|
|
import { toast } from "react-toastify";
|
|
import * as authApi from "@/domain/auth/api/auth-api";
|
|
import type { ChangePasswordPayload } from "@/domain/auth/types/auth-user";
|
|
|
|
/** Errors are rendered inline by the form that initiated the change. */
|
|
export function useChangePassword(): UseMutationResult<unknown, Error, ChangePasswordPayload> {
|
|
return useMutation({
|
|
mutationFn: (data: ChangePasswordPayload) => authApi.changePassword(data),
|
|
meta: { suppressErrorToast: true },
|
|
onSuccess: () => {
|
|
toast.success("Password updated");
|
|
},
|
|
});
|
|
}
|