.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { DateTime } from "ts-luxon";
|
import { DateTime } from "ts-luxon";
|
||||||
|
import { get, User } from "../framework/hydrators/user";
|
||||||
import { request } from "../request";
|
import { request } from "../request";
|
||||||
import { html, render } from "../request/util";
|
import { html, render } from "../request/util";
|
||||||
import type { Call, Result, Route } from "../types";
|
import type { Call, Result, Route } from "../types";
|
||||||
@@ -23,11 +24,18 @@ const routes: Record<string, Route> = {
|
|||||||
const _auth = request.auth;
|
const _auth = request.auth;
|
||||||
const me = request.session.getUser();
|
const me = request.session.getUser();
|
||||||
|
|
||||||
const email = me.toString();
|
const id = me.id;
|
||||||
|
console.log(`*** id: ${id}`);
|
||||||
|
|
||||||
|
const u = await get(id);
|
||||||
|
|
||||||
|
const email = u?.email || "anonymous@example.com";
|
||||||
|
const name = u?.display_name || "anonymous";
|
||||||
const showLogin = me.isAnonymous();
|
const showLogin = me.isAnonymous();
|
||||||
const showLogout = !me.isAnonymous();
|
const showLogout = !me.isAnonymous();
|
||||||
|
|
||||||
const c = await render("basic/home", {
|
const c = await render("basic/home", {
|
||||||
|
name,
|
||||||
email,
|
email,
|
||||||
showLogin,
|
showLogin,
|
||||||
showLogout,
|
showLogout,
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
home
|
home
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
{{ name }} - {{ email }}
|
||||||
{{ email }}
|
|
||||||
</p>
|
</p>
|
||||||
{% if showLogin %}
|
{% if showLogin %}
|
||||||
<a href="/login">login</a>
|
<a href="/login">login</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user