add: Abstract class to simplifie the code,
AbstractRedirectView, AbstractAuthentificateView AbstractUnAuthentificateView
This commit is contained in:
@ -9,6 +9,8 @@ import RegisterView from "./views/accounts/RegisterView.js";
|
||||
import LogoutView from "./views/accounts/LogoutView.js";
|
||||
|
||||
import { Client } from "./api/client.js";
|
||||
import AbstractProtectedView from "./views/AbstractRedirectView.js";
|
||||
import AbstractRedirectView from "./views/AbstractRedirectView.js";
|
||||
|
||||
let client = new Client(location.protocol + "//" + location.host)
|
||||
|
||||
@ -64,6 +66,10 @@ const router = async (uri = "") => {
|
||||
await lastView.leavePage();
|
||||
|
||||
const view = new match.route.view(getParams(match));
|
||||
|
||||
if (view instanceof AbstractRedirectView && await view.redirect())
|
||||
return 1;
|
||||
|
||||
lastView = view;
|
||||
|
||||
let content = await view.getHtml();
|
||||
|
Reference in New Issue
Block a user