2
0

feat(dashboard): Add lead generation template

While creating the template I also made sure to fix and improve everything I stumble upon
This commit is contained in:
Baptiste Arnaud
2022-02-07 07:13:16 +01:00
parent 524ef0812c
commit 1f320c5d99
20 changed files with 397 additions and 46 deletions

View File

@ -84,6 +84,13 @@ export const createTypebot = async ({
})
}
export const importTypebot = async (typebot: Typebot) =>
sendRequest<Typebot>({
url: `/api/typebots`,
method: 'POST',
body: typebot,
})
export const duplicateTypebot = async ({
folderId,
ownerId,

View File

@ -117,3 +117,14 @@ export const setMultipleRefs =
(refs: React.MutableRefObject<HTMLDivElement | null>[]) =>
(elem: HTMLDivElement) =>
refs.forEach((ref) => (ref.current = elem))
export const readFile = (file: File): Promise<string> => {
return new Promise((resolve, reject) => {
const fr = new FileReader()
fr.onload = () => {
fr.result && resolve(fr.result.toString())
}
fr.onerror = reject
fr.readAsText(file)
})
}