diff options
author | notoraptor <stevenbocco@gmail.com> | 2019-07-16 11:10:28 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-07-16 11:40:58 -0400 |
commit | fbc808296da2682fe7495f8e0b3174da517ed5ef (patch) | |
tree | 8a9a80f54bed31091e5ed41352222d576cd50a2c /diplomacy/web/src/gui/core | |
parent | 09be214dfa0741df2399c3e0c928929138de226b (diff) |
Go back to connection page from any other page if re-connection failed after all attempts.
This should fix #16 .
Diffstat (limited to 'diplomacy/web/src/gui/core')
-rw-r--r-- | diplomacy/web/src/gui/core/page.jsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/diplomacy/web/src/gui/core/page.jsx b/diplomacy/web/src/gui/core/page.jsx index 560252c..5e7aee2 100644 --- a/diplomacy/web/src/gui/core/page.jsx +++ b/diplomacy/web/src/gui/core/page.jsx @@ -59,6 +59,7 @@ export class Page extends React.Component { this._add_to_my_games = this._add_to_my_games.bind(this); this._remove_from_my_games = this._remove_from_my_games.bind(this); this._remove_from_games = this._remove_from_games.bind(this); + this.onReconnectionError = this.onReconnectionError.bind(this); } static wrapMessage(message) { @@ -75,6 +76,10 @@ export class Page extends React.Component { return <ContentConnection/>; } + onReconnectionError(error) { + this.__disconnect(error); + } + //// Methods to load a global fancybox. loadFancyBox(title, callback) { @@ -124,18 +129,18 @@ export class Page extends React.Component { //// Methods to sign out channel and go back to connection page. - __disconnect() { + __disconnect(error) { // Clear local data and go back to connection page. this.connection.close(); this.connection = null; this.channel = null; this.availableMaps = null; - const message = Page.wrapMessage(`Disconnected from channel and server.`); + const message = Page.wrapMessage(error ? `${error.toString()}` : `Disconnected from channel and server.`); Diplog.success(message); this.setState({ - error: null, + error: error ? message : null, info: null, - success: message, + success: error ? null : message, name: null, body: null, // When disconnected, remove all games previously loaded. |