around the table
This commit is contained in:
@@ -7,17 +7,24 @@ import { liveTable } from "./table";
|
||||
|
||||
const api = new Elysia({ prefix: "/api" })
|
||||
.post("/whoami", async ({ cookie: { token } }) => {
|
||||
let human;
|
||||
if (token.value == null) {
|
||||
const newHuman = await db.human.create({
|
||||
human = await db.human.create({
|
||||
data: {},
|
||||
});
|
||||
token.set({
|
||||
value: newHuman.token,
|
||||
value: human.token,
|
||||
expires: dayjs().add(1, "year").toDate(),
|
||||
httpOnly: true,
|
||||
});
|
||||
} else {
|
||||
human = await db.human.findUniqueOrThrow({
|
||||
where: {
|
||||
token: token.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
return token.value;
|
||||
return human.key;
|
||||
})
|
||||
.use(human)
|
||||
.post(
|
||||
|
||||
Reference in New Issue
Block a user