Page MenuHomeSealhub

admin.page.tsx
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

admin.page.tsx

import type { Context } from "koa";
import { TempstreamJSX } from "tempstream";
import { Page } from "@sealcode/sealgen";
import html from "src/back/html.js";
import { button } from "../elements/button.js";
import {
LoginURL,
NavbarLinksCRUDListURL,
PagesCRUDListURL,
ResetPasswordURL,
} from "./urls.js";
export const actionName = "Admin";
export default new (class AdminPage extends Page {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async canAccess(_: Context) {
return { canAccess: true, message: "" };
}
async render(ctx: Context) {
if (!ctx.$context.user_id) {
ctx.redirect(LoginURL);
ctx.status = 303;
return "";
}
return html({
ctx: ctx,
title: "Admin",
body: (
<div>
<h1>Admin panel </h1>
{[
{ text: "Edit Pages", href: PagesCRUDListURL },
{ text: "Edit Navbar", href: NavbarLinksCRUDListURL },
{ text: "Change Password", href: ResetPasswordURL },
].map((e) => button({ ...e, variant: "accent1" }))}
</div>
),
description: "",
});
}
})();

File Metadata

Mime Type
application/javascript
Expires
Sat, Nov 28, 02:51 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1192310
Default Alt Text
admin.page.tsx (1 KB)

Event Timeline