can change name

This commit is contained in:
2025-08-16 00:15:07 -05:00
parent 1c915d1713
commit c755b83d3d
2 changed files with 6 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import { Route, Router } from "@solidjs/router"; 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 { render } from "solid-js/web";
import "virtual:uno.css"; import "virtual:uno.css";
import pkg from "../package.json"; import pkg from "../package.json";
@@ -8,6 +8,7 @@ import api from "./api";
const Profile = () => { const Profile = () => {
let dialogRef!: HTMLDialogElement; let dialogRef!: HTMLDialogElement;
const [profile] = createResource(async () => api.profile.get());
return ( return (
<> <>
@@ -20,6 +21,7 @@ const Profile = () => {
<div class="fixed tr bg-emerald-100 m-2 p-4 rounded-xl border-2 shadow-md shadow-black"> <div class="fixed tr bg-emerald-100 m-2 p-4 rounded-xl border-2 shadow-md shadow-black">
Name:{" "} Name:{" "}
<input <input
value={profile()?.data?.name ?? ""}
onChange={(e) => onChange={(e) =>
api.setName.post({ name: e.target.value }) api.setName.post({ name: e.target.value })
} }

View File

@@ -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("/games", () => prisma.game.findMany())
.get("/instances", ({ query: { game } }) => .get("/instances", ({ query: { game } }) =>