feat(frontend): add, list email

This commit is contained in:
sam 2024-10-02 02:46:39 +02:00
parent 5b17c716cb
commit e030342358
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 273 additions and 9 deletions

View file

@ -0,0 +1,38 @@
import { LoaderFunctionArgs, json } from "@remix-run/node";
import { baseRequest } from "~/lib/request.server";
import { useTranslation } from "react-i18next";
import { useEffect } from "react";
import { useNavigate } from "@remix-run/react";
export const loader = async ({ params }: LoaderFunctionArgs) => {
const state = params.code!;
const resp = await baseRequest("POST", "/auth/email/callback", {
body: { state },
isInternal: true,
});
if (resp.status !== 204) {
// TODO: handle non-204 status (this indicates that the email was not linked to an account)
}
return json({ ok: true });
};
export default function ConfirmEmailPage() {
const { t } = useTranslation();
const navigate = useNavigate();
useEffect(() => {
setTimeout(() => {
navigate("/settings/auth");
}, 2000);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<>
<h3>{t("settings.auth.email-link-success")}</h3>
<p>{t("settings.auth.redirect-to-auth-hint")}</p>
</>
);
}