Vitron-Front/app/routes/logout.tsx
2026-04-29 01:44:16 +03:30

50 lines
1.5 KiB
TypeScript

import { LoaderFunctionArgs, redirect, MetaFunction } from "@remix-run/node";
import { sessionStorage } from "~/sessions.server";
export const meta: MetaFunction = () => {
const title = "خروج از حساب کاربری | ویترون";
const description = "خروج از حساب کاربری ویترون";
const imageUrl =
"https://vitrownstatics.s3.ir-thr-at1.arvanstorage.ir/SVG-06.svg?versionId=";
return [
{ title },
{ name: "description", content: description },
{ name: "robots", content: "noindex, nofollow" },
// Open Graph
{ property: "og:type", content: "website" },
{ property: "og:title", content: title },
{ property: "og:description", content: description },
{ property: "og:image", content: imageUrl },
{ property: "og:site_name", content: "ویترون" },
{ property: "og:locale", content: "fa_IR" },
// Twitter Card
{ name: "twitter:card", content: "summary_large_image" },
{ name: "twitter:title", content: title },
{ name: "twitter:description", content: description },
{ name: "twitter:image", content: imageUrl },
];
};
/**
* Logout route that destroys the session and redirects to login
*/
export async function loader({ request }: LoaderFunctionArgs) {
const session = await sessionStorage.getSession(
request.headers.get("Cookie")
);
// Destroy the session
return redirect("/", {
headers: {
"Set-Cookie": await sessionStorage.destroySession(session),
},
});
}
export default function logout() {
return <></>;
}