mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
do not show toast if 403 is triggered by forbidden image (#5447)
* do not show toast if 403 is triggered by lack of image access * remove log * lint --------- Co-authored-by: Mary Hipp <maryhipp@Marys-MacBook-Air.local>
This commit is contained in:
parent
5d87578746
commit
d86d7e5c33
@ -11,6 +11,15 @@ const zRejectedForbiddenAction = z.object({
|
|||||||
detail: z.string(),
|
detail: z.string(),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
meta: z
|
||||||
|
.object({
|
||||||
|
arg: z
|
||||||
|
.object({
|
||||||
|
endpointName: z.string().optional(),
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
|
})
|
||||||
|
.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const authToastMiddleware: Middleware =
|
export const authToastMiddleware: Middleware =
|
||||||
@ -18,6 +27,11 @@ export const authToastMiddleware: Middleware =
|
|||||||
if (isRejectedWithValue(action)) {
|
if (isRejectedWithValue(action)) {
|
||||||
try {
|
try {
|
||||||
const parsed = zRejectedForbiddenAction.parse(action);
|
const parsed = zRejectedForbiddenAction.parse(action);
|
||||||
|
if (parsed.meta?.arg?.endpointName === 'getImageDTO') {
|
||||||
|
// do not show toast if problem is image access
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { dispatch } = api;
|
const { dispatch } = api;
|
||||||
const customMessage =
|
const customMessage =
|
||||||
parsed.payload.data.detail !== 'Forbidden'
|
parsed.payload.data.detail !== 'Forbidden'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user