feat: refactor delete user mutation with the REST API endpoint
This commit is contained in:

committed by
Faruk AYDIN

parent
0e26032ac3
commit
1aa1f441b3
15
packages/web/src/hooks/useAdminUserDelete.js
Normal file
15
packages/web/src/hooks/useAdminUserDelete.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useAdminUserDelete(userId) {
|
||||
const mutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
const { data } = await api.delete(`/v1/admin/users/${userId}`);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return mutation;
|
||||
}
|
Reference in New Issue
Block a user