mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
fix(web): close connection failed alert on successful request (#6657)
This commit is contained in:
parent
dc1dc5b6b0
commit
250f43ae68
1 changed files with 12 additions and 8 deletions
|
@ -23,8 +23,8 @@ export const RPC = {
|
||||||
export class Remote {
|
export class Remote {
|
||||||
// TODO: decouple from controller
|
// TODO: decouple from controller
|
||||||
constructor(controller) {
|
constructor(controller) {
|
||||||
|
this._connection_alert = null;
|
||||||
this._controller = controller;
|
this._controller = controller;
|
||||||
this._error = '';
|
|
||||||
this._session_id = '';
|
this._session_id = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@ export class Remote {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback.call(context, payload, response_argument);
|
callback.call(context, payload, response_argument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._connection_alert = null;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.message === Remote._SessionHeader) {
|
if (error.message === Remote._SessionHeader) {
|
||||||
|
@ -66,13 +68,15 @@ export class Remote {
|
||||||
}
|
}
|
||||||
console.trace(error);
|
console.trace(error);
|
||||||
this._controller.togglePeriodicSessionRefresh(false);
|
this._controller.togglePeriodicSessionRefresh(false);
|
||||||
this._controller.setCurrentPopup(
|
|
||||||
new AlertDialog({
|
this._connection_alert = new AlertDialog({
|
||||||
heading: 'Connection failed',
|
heading: 'Connection failed',
|
||||||
message:
|
message:
|
||||||
'Could not connect to the server. You may need to reload the page to reconnect.',
|
'Could not connect to the server. You may need to reload the page to reconnect.',
|
||||||
}),
|
});
|
||||||
);
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this._controller.setCurrentPopup(this._connection_alert);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue