mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
♻️ signup
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { signup } from "@documenso/lib/api";
|
||||||
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";
|
||||||
import { Button } from "@documenso/ui";
|
import { Button } from "@documenso/ui";
|
||||||
import { XCircleIcon } from "@heroicons/react/24/outline";
|
import { XCircleIcon } from "@heroicons/react/24/outline";
|
||||||
@ -30,19 +31,9 @@ export default function Signup(props: { source: string }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const signUp: SubmitHandler<FormValues> = async (data) => {
|
const signUp: SubmitHandler<FormValues> = async (data) => {
|
||||||
// todo encapsulate
|
await toast
|
||||||
const res = await toast
|
|
||||||
.promise(
|
.promise(
|
||||||
fetch("/api/auth/signup", {
|
signup(props.source, data)
|
||||||
body: JSON.stringify({
|
|
||||||
source: props.source,
|
|
||||||
...data,
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
method: "POST",
|
|
||||||
})
|
|
||||||
.then(handleErrors)
|
.then(handleErrors)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await signIn<"credentials">("credentials", {
|
await signIn<"credentials">("credentials", {
|
||||||
|
|||||||
@ -2,3 +2,4 @@ export { createOrUpdateField } from "./createOrUpdateField";
|
|||||||
export { deleteField } from "./deleteField";
|
export { deleteField } from "./deleteField";
|
||||||
export { signDocument } from "./signDocument";
|
export { signDocument } from "./signDocument";
|
||||||
export { getUser } from "./getUser";
|
export { getUser } from "./getUser";
|
||||||
|
export { signup } from "./signup";
|
||||||
|
|||||||
12
packages/lib/api/signup.ts
Normal file
12
packages/lib/api/signup.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export const signup = (source: any, data: any) => {
|
||||||
|
return fetch("/api/auth/signup", {
|
||||||
|
body: JSON.stringify({
|
||||||
|
source: source,
|
||||||
|
...data,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
method: "POST",
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user