import { LoaderFunctionArgs, json, redirect, MetaFunction } from "@remix-run/node"; import i18n from "~/i18next.server"; import serverRequest, { getToken } from "~/lib/request.server"; import { User } from "~/lib/api/user"; import { Link, Outlet, useLocation } from "@remix-run/react"; import { Nav } from "react-bootstrap"; import { useTranslation } from "react-i18next"; export const meta: MetaFunction = ({ data }) => { return [{ title: `${data?.meta.title || "Settings"} • pronouns.cc` }]; }; export const loader = async ({ request }: LoaderFunctionArgs) => { const t = await i18n.getFixedT(request); const token = getToken(request); if (token) { try { const user = await serverRequest("GET", "/users/@me", { token }); return json({ user, meta: { title: t("settings.title") } }); } catch (e) { return redirect("/auth/log-in"); } } return redirect("/auth/log-in"); }; export default function SettingsLayout() { const { t } = useTranslation(); const { pathname } = useLocation(); return ( <>
); }