mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add middleware to handle 403 errors (#5245)
* add middleware to handle 403 errors * remove log * add logic to warn the user if not all requested images could be deleted * lint * fix copy * feat(ui): simplify batchEnqueuedListener error toast logic * feat(ui): use translations for error messages * chore(ui): lint --------- Co-authored-by: Mary Hipp <maryhipp@Marys-MacBook-Air.local> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com>
This commit is contained in:
@ -27,6 +27,8 @@ import {
|
||||
imagesSelectors,
|
||||
} from 'services/api/util';
|
||||
import { boardsApi } from './boards';
|
||||
import { addToast } from 'features/system/store/systemSlice';
|
||||
import { t } from 'i18next';
|
||||
|
||||
export const imagesApi = api.injectEndpoints({
|
||||
endpoints: (build) => ({
|
||||
@ -208,6 +210,16 @@ export const imagesApi = api.injectEndpoints({
|
||||
try {
|
||||
const { data } = await queryFulfilled;
|
||||
|
||||
if (data.deleted_images.length < imageDTOs.length) {
|
||||
dispatch(
|
||||
addToast({
|
||||
title: t('gallery.problemDeletingImages'),
|
||||
description: t('gallery.problemDeletingImagesDesc'),
|
||||
status: 'warning',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// convert to an object so we can access the successfully delete image DTOs by name
|
||||
const groupedImageDTOs = keyBy(imageDTOs, 'image_name');
|
||||
|
||||
|
Reference in New Issue
Block a user