add SSO login

This commit is contained in:
Do Manh Phuong 2026-04-01 16:56:52 +07:00
parent cf2b17d49d
commit ad0be8b7d7
4 changed files with 13 additions and 9 deletions

View File

@ -37,7 +37,7 @@ export const API_ENDPOINTS = {
//require file api //require file api
GET_REQUIRED_FILES: `${BASE_URL}/AppVersion/requirefiles`, GET_REQUIRED_FILES: `${BASE_URL}/AppVersion/requirefiles`,
ADD_REQUIRED_FILE: `${BASE_URL}/AppVersion/requirefile/add`, ADD_REQUIRED_FILE: `${BASE_URL}/AppVersion/requirefile/add`,
DELETE_REQUIRED_FILE: (fileId: number) => `${BASE_URL}/AppVersion/requirefile/delete/${fileId}`, DELETE_REQUIRED_FILE: `${BASE_URL}/AppVersion/requirefile/delete`,
DELETE_FILES: (fileId: number) => `${BASE_URL}/AppVersion/delete/${fileId}`, DELETE_FILES: (fileId: number) => `${BASE_URL}/AppVersion/delete/${fileId}`,
}, },
DEVICE_COMM: { DEVICE_COMM: {

View File

@ -160,7 +160,7 @@ export function useDeleteRequiredFile() {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation({ return useMutation({
mutationFn: (fileId: number) => appVersionService.deleteRequiredFile(fileId), mutationFn: (data: { MsiFileIds: number[] }) => appVersionService.deleteRequiredFile(data),
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: APP_VERSION_QUERY_KEYS.requiredFiles(), queryKey: APP_VERSION_QUERY_KEYS.requiredFiles(),

View File

@ -152,12 +152,15 @@ function AppsComponent() {
if (!table) return; if (!table) return;
const selectedRows = table.getSelectedRowModel().rows; const selectedRows = table.getSelectedRowModel().rows;
if (selectedRows.length === 0) {
toast.error("Vui lòng chọn ít nhất một file để xóa!");
return;
}
const MsiFileIds = selectedRows.map((row: any) => row.original.id);
try { try {
for (const row of selectedRows) { await deleteRequiredFileMutation.mutateAsync({ MsiFileIds });
const { id } = row.original;
await deleteRequiredFileMutation.mutateAsync(id);
}
toast.success("Xóa file khỏi danh sách thành công!"); toast.success("Xóa file khỏi danh sách thành công!");
if (table) { if (table) {
table.setRowSelection({}); table.setRowSelection({});

View File

@ -108,11 +108,12 @@ export async function addRequiredFile(data: any): Promise<{ message: string }> {
/** /**
* Xóa file bắt buộc * Xóa file bắt buộc
* @param fileId - ID file * @param data - DownloadMsiRequest { MsiFileIds: number[] }
*/ */
export async function deleteRequiredFile(fileId: number): Promise<{ message: string }> { export async function deleteRequiredFile(data: { MsiFileIds: number[] }): Promise<{ message: string }> {
const response = await axios.post( const response = await axios.post(
API_ENDPOINTS.APP_VERSION.DELETE_REQUIRED_FILE(fileId) API_ENDPOINTS.APP_VERSION.DELETE_REQUIRED_FILE,
data
); );
return response.data; return response.data;
} }