mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-30 18:56:45 +02:00
🐛 Use current origin as base url for code verification (#925)
This commit is contained in:
parent
1b5543d20c
commit
faaf21c08a
1 changed files with 6 additions and 3 deletions
|
@ -7,7 +7,6 @@ import React from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { createGlobalState } from "react-use";
|
import { createGlobalState } from "react-use";
|
||||||
|
|
||||||
import { absoluteUrl } from "@/utils/absolute-url";
|
|
||||||
import { usePostHog } from "@/utils/posthog";
|
import { usePostHog } from "@/utils/posthog";
|
||||||
import { trpc } from "@/utils/trpc/client";
|
import { trpc } from "@/utils/trpc/client";
|
||||||
|
|
||||||
|
@ -17,7 +16,11 @@ import { TextInput } from "../text-input";
|
||||||
export const useDefaultEmail = createGlobalState("");
|
export const useDefaultEmail = createGlobalState("");
|
||||||
|
|
||||||
const verifyCode = async (options: { email: string; token: string }) => {
|
const verifyCode = async (options: { email: string; token: string }) => {
|
||||||
const url = absoluteUrl("/api/auth/callback/email", options);
|
const url = `${
|
||||||
|
window.location.origin
|
||||||
|
}/api/auth/callback/email?email=${encodeURIComponent(options.email)}&token=${
|
||||||
|
options.token
|
||||||
|
}`;
|
||||||
|
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
|
|
||||||
|
@ -159,7 +162,7 @@ export const LoginForm: React.FunctionComponent<{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
posthog?.capture("login", {
|
posthog?.capture("login", {
|
||||||
method: "verification-code"
|
method: "verification-code",
|
||||||
});
|
});
|
||||||
router.push(callbackUrl);
|
router.push(callbackUrl);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue