mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-08 00:02:15 +01:00
Add password check to users.destroy and organizations.destroy
This commit is contained in:
committed by
Constantin Graf
parent
24c94af952
commit
6a197f7f34
@@ -1,7 +1,7 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/vue-query';
|
||||
import { computed } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { api, type UpdateUserBody, type User } from '@/packages/api/src';
|
||||
import { api, type DeleteUserBody, type UpdateUserBody, type User } from '@/packages/api/src';
|
||||
import { useNotificationsStore } from '@/utils/notification';
|
||||
|
||||
const ME_QUERY_KEY = ['me'] as const;
|
||||
@@ -61,9 +61,9 @@ export function useDeleteUserMutation() {
|
||||
const { addNotification } = useNotificationsStore();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (userId: string) => {
|
||||
mutationFn: async ({ userId, body }: { userId: string; body: DeleteUserBody }) => {
|
||||
try {
|
||||
await api.deleteUser(undefined, { params: { user: userId } });
|
||||
await api.deleteUser(body, { params: { user: userId } });
|
||||
} catch (error) {
|
||||
if (!axios.isAxiosError(error) || error.response?.status !== 422) {
|
||||
addNotification(
|
||||
|
||||
Reference in New Issue
Block a user