Added Batch Website Deletion Along With Confirmation of Deletion Of the Batch

This commit is contained in:
The-Yearly 2025-05-20 03:50:02 +05:30
parent 87cf22530c
commit 54ce27e40d
2 changed files with 4 additions and 3 deletions

View file

@ -31,7 +31,7 @@ export function WebsitesTable({
}
const checked = (websiteId: string) => {
if (deleteIds.includes(websiteId)) {
setDeleteIds(deleteIds.filter(prev => prev != websiteId));
setDeleteIds(deleteIds.filter(prev => prev !== websiteId));
} else {
setDeleteIds(prev => [...prev, websiteId]);
}
@ -44,7 +44,7 @@ export function WebsitesTable({
width="40px"
name="delete"
label={
deleteIds.length != 0 ? (
deleteIds.length > 0 ? (
<Icon
style={{ color: 'red' }}
onClick={() => {
@ -64,6 +64,7 @@ export function WebsitesTable({
return (
<Checkbox
defaultChecked={false}
checked={deleteIds.includes(websiteId)}
onChange={() => {
checked(websiteId);
}}

View file

@ -19,7 +19,7 @@ export function WebsiteDeleteForm({
if (typeof websiteId === 'string') {
return del(`/websites/${websiteId}`);
} else {
const ids = Array.isArray(websiteId) ? websiteId : [websiteId];
const ids = typeof websiteId === 'string' ? [websiteId] : websiteId;
return Promise.all(ids.map(id => del(`/websites/${id}`)));
}
},