In the Svelt File:
import { FileDropzone } from "attractions";
File-Dropzone.svelte:
async function acceptUpload(e) {
...some code...
const fetchResponse = await fetch('http://localhost:5000/upload', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({"document-array": fileParagraphs})
});
let jsonedResponse = await fetchResponse.json();
--> let responseArray = JSON.parse(jsonedResponse); - I want to use this in the main Svelte to display some content after user uploaded a file.
So the goal is to display the content from fetch made to FastAPI server. Fetch sends file Content that I get via FileDropzone from "attractions" for Svelte. I could only print response in the console as the function situated in another Svelte File.
I tried to transfer response to main Svelte and then update content on Web Page. But I don't know how to get variable's value from another Svelte file's function... I tried to export & import, but it seems impossible since the variable situated in the function.