2023-04-12 14:12:20 +03:00
|
|
|
import { getCookies } from "$std/http/cookie.ts";
|
2023-04-12 07:34:23 +03:00
|
|
|
|
2023-04-12 14:12:20 +03:00
|
|
|
export function handler(req: Request): Response {
|
|
|
|
const cookies = getCookies(req.headers);
|
|
|
|
const username = cookies["username"];
|
|
|
|
const password = cookies["password"];
|
|
|
|
|
|
|
|
if (username != null && password != null) {
|
|
|
|
return new Response("", {
|
|
|
|
status: 303,
|
|
|
|
headers: { location: "/library" },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return new Response("", {
|
|
|
|
status: 303,
|
|
|
|
headers: { location: "/login" },
|
|
|
|
});
|
|
|
|
}
|
2023-04-12 07:34:23 +03:00
|
|
|
}
|