260224:1606 20260224:1600 V1.8.0
All checks were successful
Build and Deploy / deploy (push) Successful in 6m25s

This commit is contained in:
admin
2026-02-24 16:06:15 +07:00
parent 97cc41f489
commit 158179d4a5
255 changed files with 5339 additions and 2094 deletions

View File

@@ -1,11 +1,12 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { userService } from '@/lib/services/user.service';
import { CreateUserDto, UpdateUserDto, SearchUserDto } from '@/types/user'; // Ensure types exist
import { CreateUserDto, UpdateUserDto, SearchUserDto } from '@/types/user';
import { toast } from 'sonner';
import { getApiErrorMessage } from '@/types/api-error';
export const userKeys = {
all: ['users'] as const,
list: (params: any) => [...userKeys.all, 'list', params] as const,
list: (params?: SearchUserDto) => [...userKeys.all, 'list', params] as const,
detail: (id: number) => [...userKeys.all, 'detail', id] as const,
};
@@ -31,9 +32,9 @@ export function useCreateUser() {
toast.success("User created successfully");
queryClient.invalidateQueries({ queryKey: userKeys.all });
},
onError: (error: any) => {
onError: (error: unknown) => {
toast.error("Failed to create user", {
description: error.response?.data?.message || "Unknown error"
description: getApiErrorMessage(error, "Unknown error")
});
}
});
@@ -47,9 +48,9 @@ export function useUpdateUser() {
toast.success("User updated successfully");
queryClient.invalidateQueries({ queryKey: userKeys.all });
},
onError: (error: any) => {
onError: (error: unknown) => {
toast.error("Failed to update user", {
description: error.response?.data?.message || "Unknown error"
description: getApiErrorMessage(error, "Unknown error")
});
}
});
@@ -63,9 +64,9 @@ export function useDeleteUser() {
toast.success("User deleted successfully");
queryClient.invalidateQueries({ queryKey: userKeys.all });
},
onError: (error: any) => {
onError: (error: unknown) => {
toast.error("Failed to delete user", {
description: error.response?.data?.message || "Unknown error"
description: getApiErrorMessage(error, "Unknown error")
});
}
});