mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 15:51:01 +08:00
25 lines
603 B
TypeScript
25 lines
603 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
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,
|
|
};
|
|
}
|
|
});
|