add support to delete all uncategorized images

This commit is contained in:
Mary Hipp
2025-05-29 14:54:28 -04:00
committed by psychedelicious
parent 68108435ae
commit c1d230f961
8 changed files with 529 additions and 27 deletions

View File

@@ -160,6 +160,42 @@ export const imagesApi = api.injectEndpoints({
return [];
},
}),
deleteUncategorizedImages: build.mutation<components['schemas']['DeleteImagesFromListResult'], void>({
query: () => ({ url: buildImagesUrl('uncategorized'), method: 'DELETE' }),
invalidatesTags: (result) => {
if (result && result.deleted_images.length > 0) {
const boardId = 'none';
const tags: ApiTagDescription[] = [
{
type: 'ImageList',
id: getListImagesUrl({
board_id: boardId,
categories: IMAGE_CATEGORIES,
}),
},
{
type: 'ImageList',
id: getListImagesUrl({
board_id: boardId,
categories: ASSETS_CATEGORIES,
}),
},
{
type: 'Board',
id: boardId,
},
{
type: 'BoardImagesTotal',
id: boardId,
},
];
return tags;
}
return [];
},
}),
/**
* Change an image's `is_intermediate` property.
*/
@@ -566,6 +602,7 @@ export const {
useAddImagesToBoardMutation,
useRemoveImagesFromBoardMutation,
useDeleteBoardAndImagesMutation,
useDeleteUncategorizedImagesMutation,
useDeleteBoardMutation,
useStarImagesMutation,
useUnstarImagesMutation,

File diff suppressed because it is too large Load Diff