Ethan Niser 2023-09-15 17:45:17 +00:00 committed by GitHub
parent 72f523a885
commit 10a7427d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 16 deletions

@ -0,0 +1,4 @@
function Component({ name }: { name: string }) {
return <p>this is unsafe: {name}</p>;
}

@ -41,8 +41,9 @@ export const authController = new Elysia({
const sessionCookie = auth.createSessionCookie(session);
cookie.sesion?.set(sessionCookie);
// cookie.session?.set(sessionCookie);
set.headers["Set-Cookie"] = sessionCookie.serialize();
set.headers["HX-Location"] = "/profile";
},
{
@ -87,7 +88,8 @@ export const authController = new Elysia({
});
const sessionCookie = auth.createSessionCookie(session);
cookie.sesion?.set(sessionCookie);
// cookie.sesion?.set(sessionCookie);
set.headers["Set-Cookie"] = sessionCookie.serialize();
set.headers["HX-Location"] = "/profile";
},
{

@ -11,9 +11,7 @@ export const todosController = new Elysia({
})
.use(ctx)
.get("/", async () => {
const now = performance.now();
const data = await db.select().from(todos).limit(10);
console.log("queried in", performance.now() - now);
return <TodoList todos={data} />;
})
.post(
@ -71,14 +69,11 @@ export const todosController = new Elysia({
sub: "Subscribe to Ethan",
};
const now = performance.now();
const [newTodo] = await db
.insert(todos)
.values({ content: content[body.content] })
.returning();
console.log("inserted in", performance.now() - now);
if (!newTodo) {
throw new Error("Todo not found");
}
@ -88,9 +83,6 @@ export const todosController = new Elysia({
// console.log("total time", performance.now() - now);
// });
console.log("returning");
console.log("total time", performance.now() - now);
return <TodoItem {...newTodo} />;
},
{

@ -8,9 +8,7 @@ export const profile = new Elysia()
const authRequest = auth.handleRequest(request);
const session = await authRequest.validate();
if (session) {
return html(<div>Hello {session.user.email}</div>);
} else {
return html(<div>Not logged in</div>);
}
return html(
session ? <div>Hello {session.user.email}</div> : <div>Not logged in</div>
);
});

@ -21,6 +21,6 @@
"types": [
"bun-types" // add Bun global
],
"plugins": [{ "name": "@kitajs/html/tsp" }]
// "plugins": [{ "name": "@kitajs/html/tsp" }]
}
}