mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
if backend returns an error, show it in toast
This commit is contained in:
parent
79d49853d2
commit
1809990ed4
@ -22,6 +22,8 @@ import {
|
|||||||
} from 'services/thunks/gallery';
|
} from 'services/thunks/gallery';
|
||||||
import { receivedModels } from 'services/thunks/model';
|
import { receivedModels } from 'services/thunks/model';
|
||||||
import { receivedOpenAPISchema } from 'services/thunks/schema';
|
import { receivedOpenAPISchema } from 'services/thunks/schema';
|
||||||
|
import { makeToast } from '../../../features/system/hooks/useToastWatcher';
|
||||||
|
import { addToast } from '../../../features/system/store/systemSlice';
|
||||||
|
|
||||||
type SetEventListenersArg = {
|
type SetEventListenersArg = {
|
||||||
socket: Socket<ServerToClientEvents, ClientToServerEvents>;
|
socket: Socket<ServerToClientEvents, ClientToServerEvents>;
|
||||||
@ -78,6 +80,16 @@ export const setEventListeners = (arg: SetEventListenersArg) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('connect_error', (error) => {
|
||||||
|
if (error && error.message) {
|
||||||
|
dispatch(
|
||||||
|
addToast(
|
||||||
|
makeToast({ title: error.message, status: 'error', duration: 10000 })
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect
|
* Disconnect
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user