Skip to content

Commit

Permalink
Cleanup some code and fix alert dismiss not working
Browse files Browse the repository at this point in the history
  • Loading branch information
dsevillamartin committed Nov 6, 2019
1 parent c9478ee commit 58f5d36
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/src/common/Application.js
Expand Up @@ -330,12 +330,14 @@ export default class Application {
children = app.translator.trans('core.lib.error.generic_message');
}

const isDebug = app.forum.attribute('debug');

error.alert = new Alert({
type: 'error',
children,
controls: app.forum.attribute('debug') ? [
controls: isDebug && [
<Button className="Button Button--link" onclick={this.showDebug.bind(this, error)}>Debug</Button>
] : undefined
]
});

try {
Expand All @@ -355,7 +357,7 @@ export default class Application {
* @private
*/
showDebug(error) {
this.alerts.dismiss(this.requestErrorAlert);
this.alerts.dismiss(this.requestError.alert);

this.modal.show(new RequestErrorModal({error}));
}
Expand Down

0 comments on commit 58f5d36

Please sign in to comment.