feat: add first version of nocode editor without preview/publish/share

This commit is contained in:
Matthias Nannt
2022-06-20 20:04:23 +09:00
parent b622510dc4
commit ae5ae7b46c
20 changed files with 557 additions and 131 deletions

View File

@@ -30,3 +30,15 @@ export const createNoCodeForm = async (formId) => {
);
}
};
export const persistNoCodeForm = async (noCodeForm) => {
try {
await fetch(`/api/forms/${noCodeForm.formId}/nocodeform`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(noCodeForm),
});
} catch (error) {
console.error(error);
}
};

16
lib/pipelines.ts Normal file
View File

@@ -0,0 +1,16 @@
import useSWR from "swr";
import { fetcher } from "./utils";
export const usePipelines = (formId: string) => {
const { data, error, mutate } = useSWR(
() => `/api/forms/${formId}/pipelines`,
fetcher
);
return {
pipelines: data,
isLoadingPipelines: !error && !data,
isErrorPipelines: error,
mutatePipeliness: mutate,
};
};