Files
online-energieausweis/src/lib/UI/isLoggedIn.ts
2023-03-29 00:08:47 +04:00

14 lines
319 B
TypeScript

import type { AstroGlobal } from "astro";
import moment from "moment";
export function isLoggedIn(astro: AstroGlobal): boolean {
if (!astro.cookies.has("token")) {
return false;
}
if (astro.cookies.has("expires") && (astro.cookies.get("expires").number() > moment().unix())) {
return true;
}
return false;
}