feat: use REST API endpoint to delete current user
This commit is contained in:
14
packages/web/src/hooks/useDeleteCurrentUser.js
Normal file
14
packages/web/src/hooks/useDeleteCurrentUser.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import api from 'helpers/api';
|
||||
|
||||
export default function useDeleteCurrentUser(userId) {
|
||||
const query = useMutation({
|
||||
mutationFn: async () => {
|
||||
const { data } = await api.delete(`/v1/users/${userId}`);
|
||||
|
||||
return data;
|
||||
},
|
||||
});
|
||||
|
||||
return query;
|
||||
}
|
Reference in New Issue
Block a user