From c755b83d3db64ed253232c7d8075d1054b5d4849 Mon Sep 17 00:00:00 2001 From: Daniel McCrystal Date: Sat, 16 Aug 2025 00:15:07 -0500 Subject: [PATCH] can change name --- packages/client/src/app.tsx | 4 +++- packages/server/src/api.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/client/src/app.tsx b/packages/client/src/app.tsx index b303190..d75eca2 100644 --- a/packages/client/src/app.tsx +++ b/packages/client/src/app.tsx @@ -1,5 +1,5 @@ import { Route, Router } from "@solidjs/router"; -import { lazy, Suspense } from "solid-js"; +import { createResource, lazy, Suspense } from "solid-js"; import { render } from "solid-js/web"; import "virtual:uno.css"; import pkg from "../package.json"; @@ -8,6 +8,7 @@ import api from "./api"; const Profile = () => { let dialogRef!: HTMLDialogElement; + const [profile] = createResource(async () => api.profile.get()); return ( <> @@ -20,6 +21,7 @@ const Profile = () => {
Name:{" "} api.setName.post({ name: e.target.value }) } diff --git a/packages/server/src/api.ts b/packages/server/src/api.ts index b7896ca..6ccd679 100644 --- a/packages/server/src/api.ts +++ b/packages/server/src/api.ts @@ -31,6 +31,9 @@ const api = new Elysia({ prefix: "/api" }) }), } ) + .get("/profile", ({ cookie: { token: humanKey } }) => + prisma.human.findFirst({ where: { key: humanKey.value } }) + ) .get("/games", () => prisma.game.findMany()) .get("/instances", ({ query: { game } }) =>