Refactored notification logic to method
This commit is contained in:
parent
a51a6065b8
commit
53f31ddcc9
|
@ -212,21 +212,23 @@ class AppComponent extends AuthComponent {
|
|||
}
|
||||
|
||||
showInfectionDoneNotification() {
|
||||
if (this.state.completedSteps.infection_done) {
|
||||
// No need to show the notification to redirect to the report if we're already in the report page
|
||||
if (!window.location.href.includes("report")) {
|
||||
const hostname = window.location.hostname;
|
||||
const port = window.location.port;
|
||||
let url = `https://${hostname}:${port}${reportZeroTrustRoute}`;
|
||||
if (this.shouldShowNotification()) {
|
||||
const hostname = window.location.hostname;
|
||||
const port = window.location.port;
|
||||
const url = `https://${hostname}:${port}${reportZeroTrustRoute}`;
|
||||
|
||||
Notifier.start(
|
||||
"Monkey Island",
|
||||
"Infection is done! Click here to go to the report page.",
|
||||
url,
|
||||
notificationIcon);
|
||||
}
|
||||
Notifier.start(
|
||||
"Monkey Island",
|
||||
"Infection is done! Click here to go to the report page.",
|
||||
url,
|
||||
notificationIcon);
|
||||
}
|
||||
}
|
||||
|
||||
shouldShowNotification() {
|
||||
// No need to show the notification to redirect to the report if we're already in the report page
|
||||
return (this.state.completedSteps.infection_done && !window.location.pathname.startsWith("/report"));
|
||||
}
|
||||
}
|
||||
|
||||
AppComponent.defaultProps = {};
|
||||
|
|
Loading…
Reference in New Issue