init login

This commit is contained in:
2023-11-23 17:26:09 +01:00
parent 267eeab896
commit ea42d10ddf
4 changed files with 81 additions and 2 deletions

View File

@ -1,8 +1,13 @@
import LoginView from "./views/accounts/LoginView.js";
import Dashboard from "./views/Dashboard.js";
import Posts from "./views/Posts.js";
import PostView from "./views/PostView.js";
import Settings from "./views/Settings.js";
import { Client } from "./api/client.js";
let client = new Client(location.protocol + "//" + location.host)
const pathToRegex = path => new RegExp("^" + path.replace(/\//g, "\\/").replace(/:\w+/g, "(.+)") + "$");
const getParams = match => {
@ -24,7 +29,8 @@ const router = async () => {
{ path: "/", view: Dashboard },
{ path: "/posts", view: Posts },
{ path: "/posts/:id", view: PostView },
{ path: "/settings", view: Settings }
{ path: "/settings", view: Settings },
{ path: "/login", view: LoginView },
];
// Test each route for potential match
@ -60,4 +66,6 @@ document.addEventListener("DOMContentLoaded", () => {
});
router();
});
});
export { client }