Skip to content

Commit

Permalink
change url after error
Browse files Browse the repository at this point in the history
  • Loading branch information
hoseinzadehashraf committed Apr 5, 2024
1 parent a8815b5 commit 9307ba2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/bundle-built.js
Original file line number Diff line number Diff line change
Expand Up @@ -37475,6 +37475,8 @@ define('app/error/errorViewsNavigator',["require", "exports", "./errorTemplates"
Object.defineProperty(exports, "__esModule", { value: true });
class ErrorViewsNavigator {
static showServiceError(trigger, service, url, response) {
let addressBar = url.trimHttpProtocol().replace(service.BaseUrl.trimHttpProtocol(), service.Name).withPrefix("/");
window.history.pushState(null, service.Name, addressBar);
let errorContent = errorTemplates_1.SERVICE_ERROR_TEMPLATE
.replace("[#URL#]", url)
.replace("[#STATUS#]", response.status == 404 ? "404 - Resource not found" : "Keep calm and try again later!")
Expand All @@ -37496,8 +37498,6 @@ define('app/error/errorViewsNavigator',["require", "exports", "./errorTemplates"
return;
}
$("main").html(errorContent);
let addressBar = url.trimHttpProtocol().replace(service.BaseUrl.trimHttpProtocol(), service.Name).withPrefix("/");
window.history.pushState(null, service.Name, addressBar);
}
}
exports.default = ErrorViewsNavigator;
Expand Down
2 changes: 1 addition & 1 deletion dist/bundle-built.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/error/errorViewsNavigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { SERVICE_ERROR_TEMPLATE } from './errorTemplates';
export default class ErrorViewsNavigator {
public static showServiceError(trigger: JQuery, service: Service, url: string, response: JQueryXHR) {

let addressBar = url.trimHttpProtocol().replace(service.BaseUrl.trimHttpProtocol(), service.Name).withPrefix("/");
window.history.pushState(null, service.Name, addressBar);

let errorContent = SERVICE_ERROR_TEMPLATE
.replace("[#URL#]", url)
.replace("[#STATUS#]", response.status == 404 ? "404 - Resource not found" : "Keep calm and try again later!")
Expand All @@ -32,8 +35,5 @@ export default class ErrorViewsNavigator {
}

$("main").html(errorContent);

let addressBar = url.trimHttpProtocol().replace(service.BaseUrl.trimHttpProtocol(), service.Name).withPrefix("/");
window.history.pushState(null, service.Name, addressBar);
}
}

0 comments on commit 9307ba2

Please sign in to comment.