add: home
This commit is contained in:
parent
27044e9bdb
commit
25721bdda8
@ -4,9 +4,10 @@ import Posts from "./views/Posts.js";
|
||||
import PostView from "./views/PostView.js";
|
||||
import Settings from "./views/Settings.js";
|
||||
import Chat from "./views/Chat.js";
|
||||
import HomeView from "./views/HomeView.js";
|
||||
import RegisterView from "./views/accounts/RegisterView.js";
|
||||
|
||||
import { Client } from "./api/client.js";
|
||||
import RegisterView from "./views/accounts/RegisterView.js";
|
||||
|
||||
let client = new Client(location.protocol + "//" + location.host)
|
||||
|
||||
@ -35,6 +36,7 @@ const router = async () => {
|
||||
{ path: "/login", view: LoginView },
|
||||
{ path: "/register", view: RegisterView },
|
||||
{ path: "/chat", view: Chat },
|
||||
{ path: "/home", view: HomeView },
|
||||
];
|
||||
|
||||
// Test each route for potential match
|
||||
@ -74,4 +76,4 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
router();
|
||||
});
|
||||
|
||||
export { client }
|
||||
export { client, navigateTo }
|
||||
|
17
frontend/static/js/views/HomeView.js
Normal file
17
frontend/static/js/views/HomeView.js
Normal file
@ -0,0 +1,17 @@
|
||||
import AbstractView from "./AbstractView.js";
|
||||
import { client, navigateTo } from "../index.js";
|
||||
|
||||
export default class extends AbstractView {
|
||||
constructor(params) {
|
||||
super(params);
|
||||
if (client.isAuthentificate() == false)
|
||||
navigateTo("/home");
|
||||
this.setTitle("register");
|
||||
}
|
||||
|
||||
async getHtml() {
|
||||
return `
|
||||
<h1>HOME</h1>
|
||||
`;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user