mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-29 18:00:26 -06:00
fix newFormModal when selecting code form
This commit is contained in:
@@ -75,7 +75,7 @@ cp .env.example .env
|
||||
|
||||
```
|
||||
|
||||
npx prisma migrate dev
|
||||
yarn prisma migrate dev
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -35,10 +35,6 @@ export default function FormList() {
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
console.log(JSON.stringify(forms, null, 2));
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
|
||||
@@ -123,10 +123,6 @@ export default function Builder({ formId }) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
{
|
||||
console.log("loaded nocode");
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<SecondNavBar>
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function NewFormModal({
|
||||
const [name, setName] = useState("");
|
||||
const [formType, setFormType] = useState(formTypes[0]);
|
||||
|
||||
const submitForm = async (e) => {
|
||||
const createFormAction = async (e) => {
|
||||
e.preventDefault();
|
||||
const form = await createForm({
|
||||
name,
|
||||
@@ -93,7 +93,7 @@ export default function NewFormModal({
|
||||
</h2>
|
||||
</div>
|
||||
<form
|
||||
onSubmit={(e) => submitForm(e)}
|
||||
onSubmit={(e) => createFormAction(e)}
|
||||
className="inline-block w-full p-2 overflow-hidden text-left align-bottom transition-all transform sm:align-middle"
|
||||
>
|
||||
<div>
|
||||
|
||||
@@ -37,7 +37,7 @@ export default async function handle(
|
||||
// Required fields in body: -
|
||||
// Optional fields in body: title, elements, elementsDraft
|
||||
else if (req.method === "POST") {
|
||||
const { name, schema } = req.body;
|
||||
const form = req.body;
|
||||
|
||||
const session = await getSession({ req });
|
||||
// get unique alphanumeric ID
|
||||
@@ -50,9 +50,8 @@ export default async function handle(
|
||||
// create form in database
|
||||
const result = await prisma.form.create({
|
||||
data: {
|
||||
...form,
|
||||
id,
|
||||
name: name || "",
|
||||
schema: schema || {},
|
||||
owner: { connect: { email: session?.user?.email } },
|
||||
},
|
||||
});
|
||||
|
||||
@@ -11,9 +11,9 @@ CREATE TABLE "Form" (
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"ownerId" INTEGER NOT NULL,
|
||||
"formType" "FormType" NOT NULL DEFAULT E'NOCODE',
|
||||
"name" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL DEFAULT E'',
|
||||
"published" BOOLEAN NOT NULL DEFAULT false,
|
||||
"schema" JSONB NOT NULL,
|
||||
"schema" JSONB NOT NULL DEFAULT '{}',
|
||||
|
||||
CONSTRAINT "Form_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
@@ -23,9 +23,9 @@ model Form {
|
||||
owner User @relation(fields: [ownerId], references: [id])
|
||||
ownerId Int
|
||||
formType FormType @default(NOCODE)
|
||||
name String
|
||||
name String @default("")
|
||||
published Boolean @default(false)
|
||||
schema Json
|
||||
schema Json @default("{}")
|
||||
submissionSessions SubmissionSession[]
|
||||
pipelines Pipeline[]
|
||||
noCodeForm NoCodeForm?
|
||||
|
||||
Reference in New Issue
Block a user