Initial commit

This commit is contained in:
Thilo Hohlt
2024-07-31 07:23:32 +02:00
commit a7f2fdebf5
36 changed files with 4235 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
export const actions = {
default: async ({ request, cookies, fetch }) => {
const data = await request.formData();
const res = await fetch("http://localhost:3000/rpc/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
username: data.get("username"),
password: data.get("password")
})
});
const response = await res.json();
if (!res.ok) {
return { success: false, message: response.message };
}
cookies.set("session_token", response.token, { path: "/" });
return { success: true };
}
};