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:
@ -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,
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user