fix: Dont throw back to / if desk page not found (#19494)

This commit is contained in:
Ankush Menat 2023-01-06 10:54:02 +05:30 committed by GitHub
parent deaaa789cf
commit 010aa4636a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View file

@ -168,7 +168,6 @@ frappe.Application = class Application {
}
set_route() {
frappe.flags.setting_original_route = true;
if (frappe.boot && localStorage.getItem("session_last_route")) {
frappe.set_route(localStorage.getItem("session_last_route"));
localStorage.removeItem("session_last_route");
@ -176,7 +175,6 @@ frappe.Application = class Application {
// route to home page
frappe.router.route();
}
frappe.after_ajax(() => (frappe.flags.setting_original_route = false));
frappe.router.on("change", () => {
$(".tooltip").hide();
});

View file

@ -135,16 +135,11 @@ frappe.request.call = function (opts) {
}
},
404: function (xhr) {
if (frappe.flags.setting_original_route) {
// original route is wrong, redirect to login
frappe.app.redirect_to_login();
} else {
frappe.msgprint({
title: __("Not found"),
indicator: "red",
message: __("The resource you are looking for is not available"),
});
}
frappe.msgprint({
title: __("Not found"),
indicator: "red",
message: __("The resource you are looking for is not available"),
});
},
403: function (xhr) {
if (frappe.session.user === "Guest" && frappe.session.logged_in_user !== "Guest") {