fix group and member

This commit is contained in:
unknown
2025-04-07 22:24:01 +07:00
parent 0ea70f12ad
commit 8ff435156d
2 changed files with 13 additions and 6 deletions

View File

@ -22,6 +22,7 @@ import { useState, useEffect } from 'react';
import CloseIcon from '@mui/icons-material/Close';
import Divider from '@mui/material/Divider';
import ConfirmDialog from '@/components/confirm';
import { toast } from 'sonner';
// import { DialogHeader } from '@/components/ui/dialog';
// import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
const BASE_URL = apiConfig.service_customer;
@ -125,24 +126,29 @@ const ManageGroups = () => {
await axios.post(`${BASE_URL}/groups/create`, {
name: formData.groupName,
status: formData.status,
description: formData.description,
created_at: new Date()
});
toast.success(`Success create group`)
} else if (dialogType === 'update') {
await axios.put(`${BASE_URL}/groups/update/${formData.id}`, {
name: formData.groupName,
status: formData.status,
description: formData.description,
updated_at: new Date()
});
toast.success(`Success update group`)
} else if (dialogType === 'delete') {
await axios.delete(`${BASE_URL}/groups/delete/${formData.id}/true`);
toast.success(`Success delete group`)
}
await fetchGroups();
closeDialog();
setDialogOpen(false);
} catch (error) {
} catch (error: any) {
console.log(error);
closeDialog();
toast.error(error.message)
} finally {
await fetchGroups();
setDialogOpen(false);
closeDialog();
}
};

View File

@ -403,6 +403,7 @@ function getAdmAccess(page: string, data: any, handleClose: any, fetchCustomers:
toast.error(error.message)
} finally {
setChangeGroupD(false)
handleClose()
}
}
@ -506,5 +507,5 @@ function getPinStatus(status: string) {
}
function showCustomerWallet() {
}