This commit is contained in:
Joonas 2023-01-21 14:09:35 +02:00
parent f84da2f69a
commit e2bee89d22
1 changed files with 4 additions and 4 deletions

View File

@ -6,10 +6,6 @@ import { commitSession } from "~/sessions";
export async function loader({ request }) {
const session = await getSession(request.headers.get("Cookie"));
if (session.has("userId")) {
return redirect("/");
}
const url = new URL(request.url);
try {
@ -18,6 +14,10 @@ export async function loader({ request }) {
throw new Error("state mismatch");
}
if (session.has("userId")) {
return redirect("/");
}
const code = url.searchParams.get("code");
if (!code) return redirect("/");