fix: accounts: when logout go back to last page

This commit is contained in:
starnakin 2024-02-13 15:52:46 +01:00 committed by AdrienLSH
parent 459cf11533
commit ebddae83f3
6 changed files with 9 additions and 13 deletions

View File

@ -115,11 +115,9 @@ const router = async(uri) => {
const view = new match.route.view(getParams(match), lastPageUrlBeforeLogin);
if (await client.isAuthenticated() === false && !(view instanceof AuthenticationView))
if (!(view instanceof AuthenticationView) && ! (view instanceof LogoutView))
lastPageUrlBeforeLogin = uri;
console.log(lastPageUrlBeforeLogin)
if (view instanceof AbstractRedirectView && await view.redirect())
return 1;

View File

@ -2,8 +2,8 @@ import { client, navigateTo } from "../../index.js";
import AbstractRedirectView from "./AbstractRedirectView.js";
export default class extends AbstractRedirectView{
constructor(params, title) {
super(params, title, "/login");
constructor(params, title, uri = "/home") {
super(params, title, uri);
}
async redirect()

View File

@ -2,8 +2,8 @@ import { client, navigateTo } from "../../index.js";
import AbstractRedirectView from "./AbstractRedirectView.js";
export default class extends AbstractRedirectView{
constructor(params, title, url) {
super(params, title, url);
constructor(params, title, uri = "/home") {
super(params, title, uri);
}
async redirect()

View File

@ -2,14 +2,14 @@ import { navigateTo } from "../../index.js";
import AbstractView from "./AbstractView.js";
export default class extends AbstractView{
constructor(params, title, url)
constructor(params, title, uri)
{
super(params, title);
this.redirect_url = url;
this.redirect_url = uri;
}
async redirect()
{
navigateTo(url);
navigateTo(this.redirect_url);
}
}

View File

@ -7,9 +7,7 @@ export default class extends AbstractNonAuthenticatedView
{
constructor(params, lastUrlBeforeLogin = '/home')
{
super(params, lang.get('loginWindowTitle', 'Login'), lastUrlBeforeLogin);
this.redirect_url = lastUrlBeforeLogin;
this.current_mode = undefined
}

View File

@ -4,7 +4,7 @@ import AbstractAuthenticatedView from "../abstracts/AbstractAuthenticatedView.js
export default class extends AbstractAuthenticatedView
{
constructor(params, lastPageUrl = '/login') {
super(params, lang.get('logoutWindowTitle', 'Logout'));
super(params, lang.get('logoutWindowTitle', 'Logout'), lastPageUrl);
this.lastPageUrl = lastPageUrl;
}