feat(reset-password): implement reset password functionality for admins and customers

- Added new ResetPasswordModalContent component for displaying generated passwords.
- Integrated reset password functionality in the AdminsTable and CustomersTable components, allowing users to reset passwords for admins and customers.
- Created useResetPasswordModalPresenter hook to manage password visibility and clipboard copying.
- Updated API services and hooks to support reset password requests for both admins and customers.
- Enhanced tooltip functionality for reset password actions in the tables.
This commit is contained in:
AmirReza Jamali
2026-05-30 12:09:57 +03:30
parent 746107e977
commit 5ef0298840
16 changed files with 480 additions and 9 deletions
+19
View File
@@ -129,6 +129,25 @@ export const useUpdateCustomer = (id: string) => {
});
};
export const useResetCustomerPassword = ({
successCallback,
}: {
successCallback?: (password: string) => void;
} = {}) => {
const mutationKey = useMemo(
() => [API_ENDPOINTS.CUSTOMERS.READ_ALL, "reset-password"],
[],
);
return useMutation({
mutationKey,
mutationFn: customersService.resetCustomerPassword,
onSuccess: (response) => {
toast.success(response.message);
successCallback?.(response.data.password);
},
});
};
export const useDeleteCustomerQuery = (successCallback?: () => void) => {
const queryClient = useQueryClient();
const mutationKey = useMemo(
+19
View File
@@ -135,6 +135,25 @@ export const useGetUsersQuery = (params?: Record<string, any>) => {
queryFn: () => userService.adminsList(params),
});
};
export const useResetAdminPassword = ({
successCallback,
}: {
successCallback?: (password: string) => void;
} = {}) => {
const mutationKey = useMemo(
() => [API_ENDPOINTS.USER.ADMINS, "reset-password"],
[],
);
return useMutation({
mutationKey,
mutationFn: userService.resetAdminPassword,
onSuccess: (response) => {
toast.success(response.message);
successCallback?.(response.data.password);
},
});
};
export const useChangeAdminStatus = ({
id,
successCallback,