import { IFileData } from "./types" import { client } from "." export async function triggerUploadModal() { return new Promise(resolve => { const fileInput = document.createElement("input") fileInput.setAttribute("type", "file") document.body.appendChild(fileInput) fileInput.addEventListener("change", async (e: any) => { const file = e.target.files[0] if (!file) { resolve(null) } else { const uploadedFile = await client.uploadFile(file) resolve(uploadedFile) } }) fileInput.click() }) }