Async/Await question

Say I have two functions:

upload1(); // uploads first file
upload2();// uploads second file

Since they’re not returning anything, (or I have missed the concept of return ) and just uploading the file, my code looks like this:

export async function uploadButton_click(event) {
let one = await upload1();
let two = await upload2();
}

What I was hoping for is for the functions to run in sequence, but here, both the functions runs simultaneously. What is happening? I’m confused. Any help is appreciated. :pray:t3:

How do the upload functions look like?
Can you send a code snippet please?

Hey Hason. Below is the code for the upload function:

function upload1() {
if (wixWindow.rendering.env === “browser”) {
let uploadButton = $w(“#uploadButton9”);
let waitSuccess = $w(“#text38”);
let error = $w(“#text39”);

    if (uploadButton.value.length > 0) { // visitor chose a file 
        error.hide(); 
        waitSuccess.show(); 
        waitSuccess.text = "Uploading " + "- Please wait."; 
        uploadButton.startUpload() 
            .then((uploadedFile) => { 

                let fileLocation = uploadedFile.url; 

                $w("#dataset1").onReady(() => { 

                    $w("#dataset1").setFieldValues({ 
                        "title": $w("#imageTitle").value, 
                        "description": $w("#imageDescription").value, 
                        "image": fileLocation //$w("#uploadButton9").value 
                    }); 
                    $w("#dataset1").save(); 
                    waitSuccess.text = "Done"; 

                }); 
            }) 
    } 
} 

}