Mainly make the python code to make it javascript for nuxt to access.

Python is just used for testing stuff, as it is a fine lang to do so.
This commit is contained in:
yuanhau 2025-05-18 09:28:08 +08:00
parent 81012f5061
commit 5f78e8c58a
9 changed files with 71 additions and 2 deletions

View file

@ -1,3 +1,24 @@
export default defineEventHandler(async (event) => {
return "logging out...";
const loginCookie = getCookie(event, "session");
const lastCheckCookie = getCookie(event, "last_check");
const nowDate = new Date().toLocaleString();
try {
if (loginCookie) {
deleteCookie(event, "session");
setCookie(event, "lastCheckCookie", nowDate, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
path: "/",
});
return {
success: true,
error: null,
};
}
} catch (e) {
return {
success: false,
error: e.message,
};
}
});