import { ActionFunction, redirect } from "@remix-run/node"; import { fastRequest, getToken, writeCookie } from "~/lib/request.server"; import { tokenCookieName } from "~/lib/utils"; import { Button, Form } from "react-bootstrap"; import { useTranslation } from "react-i18next"; import { Form as RemixForm, Link } from "@remix-run/react"; export const action: ActionFunction = async ({ request }) => { const token = getToken(request); if (!token) return redirect("/", { status: 303, headers: { "Set-Cookie": writeCookie(tokenCookieName, "token", 0) }, }); await fastRequest("POST", "/auth/force-log-out", { token, isInternal: true }); return redirect("/", { status: 303, headers: { "Set-Cookie": writeCookie(tokenCookieName, "token", 0) }, }); }; export const loader = () => { return null; }; export default function ForceLogoutPage() { const { t } = useTranslation(); return ( <>
{t("settings.general.log-out-everywhere-confirm")}