add: Abstract class to simplifie the code,
AbstractRedirectView, AbstractAuthentificateView AbstractUnAuthentificateView
This commit is contained in:
@ -1,18 +1,13 @@
|
||||
import AbstractView from "./AbstractView.js";
|
||||
import { client, navigateTo } from "../index.js";
|
||||
import AbstractAuthentificateView from "./AbstractAuthentificateView.js";
|
||||
|
||||
export default class extends AbstractView {
|
||||
export default class extends AbstractAuthentificateView {
|
||||
constructor(params) {
|
||||
super(params);
|
||||
this.setTitle("Home");
|
||||
this.redirect_url = "/login"
|
||||
}
|
||||
|
||||
async getHtml() {
|
||||
if (await client.isAuthentificate() === false)
|
||||
{
|
||||
navigateTo("/login");
|
||||
return;
|
||||
}
|
||||
return `
|
||||
<h1>HOME</h1>
|
||||
<a href="/logout" class="nav__link" data-link>Logout</a>
|
||||
|
Reference in New Issue
Block a user