fix(web): close connection failed alert on successful request (#6657)

This commit is contained in:
Hendrik Luup 2024-03-04 05:00:44 +02:00 committed by GitHub
parent dc1dc5b6b0
commit 250f43ae68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 8 deletions

View File

@ -23,8 +23,8 @@ export const RPC = {
export class Remote {
// TODO: decouple from controller
constructor(controller) {
this._connection_alert = null;
this._controller = controller;
this._error = '';
this._session_id = '';
}
@ -56,6 +56,8 @@ export class Remote {
if (callback) {
callback.call(context, payload, response_argument);
}
this._connection_alert = null;
})
.catch((error) => {
if (error.message === Remote._SessionHeader) {
@ -66,13 +68,15 @@ export class Remote {
}
console.trace(error);
this._controller.togglePeriodicSessionRefresh(false);
this._controller.setCurrentPopup(
new AlertDialog({
heading: 'Connection failed',
message:
'Could not connect to the server. You may need to reload the page to reconnect.',
}),
);
this._connection_alert = new AlertDialog({
heading: 'Connection failed',
message:
'Could not connect to the server. You may need to reload the page to reconnect.',
});
})
.finally(() => {
this._controller.setCurrentPopup(this._connection_alert);
});
}