Made a bunch of changes to the source code. And polish the deploying

process.
This commit is contained in:
yuanhau 2025-05-18 16:59:03 +08:00
parent 1200505451
commit fc7b835d68
5 changed files with 72 additions and 20 deletions

View file

@ -1,5 +1,5 @@
// This should be hooked up to a database soon.
import postgres from "~/server/components/postgres";
import sql from "~/server/components/postgres";
// Parse Date Function
function checkDate(dateString: string) {
@ -40,8 +40,25 @@ export default defineEventHandler(async (event) => {
path: "/",
});
}
if (!loginCookie) {
setCookie(event, "lastCheckCookie", nowDate, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
path: "/",
});
return {
auth: false,
user: null,
};
}
const loginCookieStore = atob(loginCookie);
/*const findUser = sql`
select * from userlogintokens
where token = ${loginCookieStore}
`;*/
return {
auth: true,
user: "testing",
loginCookie: loginCookieStore, // Debug
};
});