Skip to content

Commit d86d7e5

Browse files
maryhippMary Hipp
andauthored
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 <[email protected]>
1 parent 5d87578 commit d86d7e5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

invokeai/frontend/web/src/services/api/authToastMiddleware.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,27 @@ const zRejectedForbiddenAction = z.object({
1111
detail: z.string(),
1212
}),
1313
}),
14+
meta: z
15+
.object({
16+
arg: z
17+
.object({
18+
endpointName: z.string().optional(),
19+
})
20+
.optional(),
21+
})
22+
.optional(),
1423
});
1524

1625
export const authToastMiddleware: Middleware =
1726
(api: MiddlewareAPI) => (next) => (action) => {
1827
if (isRejectedWithValue(action)) {
1928
try {
2029
const parsed = zRejectedForbiddenAction.parse(action);
30+
if (parsed.meta?.arg?.endpointName === 'getImageDTO') {
31+
// do not show toast if problem is image access
32+
return;
33+
}
34+
2135
const { dispatch } = api;
2236
const customMessage =
2337
parsed.payload.data.detail !== 'Forbidden'

0 commit comments

Comments
 (0)