feat: link discord account to existing account
This commit is contained in:
parent
c4cb08cdc1
commit
201c56c3dd
12 changed files with 333 additions and 14 deletions
|
@ -0,0 +1,26 @@
|
|||
import { LoaderFunctionArgs, redirect, json } from "@remix-run/node";
|
||||
import serverRequest, { getToken } from "~/lib/request.server";
|
||||
import { ApiError } from "~/lib/api/error";
|
||||
import { useLoaderData } from "@remix-run/react";
|
||||
import ErrorAlert from "~/components/ErrorAlert";
|
||||
|
||||
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
const token = getToken(request);
|
||||
|
||||
try {
|
||||
const { url } = await serverRequest<{ url: string }>("GET", "/auth/discord/add-account", {
|
||||
isInternal: true,
|
||||
token,
|
||||
});
|
||||
|
||||
return redirect(url, 303);
|
||||
} catch (e) {
|
||||
return json({ error: e as ApiError });
|
||||
}
|
||||
};
|
||||
|
||||
export default function AddDiscordAccountPage() {
|
||||
const { error } = useLoaderData<typeof loader>();
|
||||
|
||||
return <ErrorAlert error={error} />;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue