[SOLVED]Problem regarding saving data in live collection

@stcroppe
Site: https://pronilchakraborty0.wixsite.com/mysite-1
Here is the code,

export function retireve_click(event, $w) {

function SaveDataToDatabase() {

    getplayer($w('#input1').value).then(res => { 
        console.log(res); 

let toInsert = {

“title”: res[0].Name,
“playerId”: res[0].Id,
“playerLevel”:res[0].Level,
“accountCreated”: res[0].Created_Datetime,
“lastLogin”: res[0].Last_Login_Datetime,
“winsLoss”: res[0].Wins + " " + “/” + " " + res[0].Losses,
“matchAfk”: res[0].Leaves,
“masteryLevel”: res[0].MasteryLevel,
“region”: res[0].Region,
“achievementCompleted”: res[0].Total_Achievements,

“rankSeason”: "Season: " + res[0].RankedConquest.Season,
“rankName”: res[0].RankedConquest.Name,
“rankWinsLoss”: res[0].RankedConquest.Wins + " " + “/” + " " + res[0].RankedConquest.Losses,
“rankTp”: res[0].RankedConquest.Points,
“rankTier”: res[0].RankedConquest.Tier,
“rankAfk”:res[0].RankedConquest.Leaves,
“previousRank”:res[0].RankedConquest.PrevRank

                }; 

//BELOW IS THE SUPPRESS PERMISSION for INSERTing INTO DATABASE
let options = {
“suppressAuth”: true ,
“suppressHooks”: true
};
wixData.insert(“SUMMARY”, toInsert,options)

                    .then(results => { 

let item = results;
console.log(item) //see item below
})
. catch (err => {
let errorMsg = err;
console.log(errorMsg);
});

    }); 

    wixLocation.to("https://pronilchakraborty0.wixsite.com/mysite-1/summary/"); 

} 

function ErrorTextCalls(condition) { //ErrorTextCalls function gets called when an error msg need to be shown at #text13 according to 3 different conditions
let fadeOptions = {
“duration”: 1700,
“delay”: 2000
};

    $w('#text13').text = " "; 
    $w('#text13').show(); 

if (condition === “playerName”) {

        $w('#text13').text = "Error: Please Type Username"; 

    }  **else if**  (condition === "noPlatform") { 

        $w('#text13').text = "Error: Please Select Platform"; 

    }  **else if**  (condition === "notFound") { 

        $w('#text13').text = "Error: Player Not Found !!!"; 
    } 
    $w('#text13').hide("fade", fadeOptions); 
} 

if ($w(‘#input1’).value === ‘’) {
//If the User didnt typed anyName at the input1 location

    ErrorTextCalls("playerName"); 

return ;
}
if ($w(‘#input1’).value !== ‘’) { //if the user typed something in input1

if ($w(‘#dropdown1’).value === ‘’) { //if the user didnt selected anything in the dropdown menu

        ErrorTextCalls("noPlatform"); 

return ;

    } 
} 

if ($w(‘#dropdown1’).value === ‘pc’) { //if the user selected pc from dropdown menu

    getplayerstatus($w('#input1').value).then(res => { 

        console.log(res); 

if (res[0].status_string === ‘Unknown’) { //if username not found according to the Paladins API

            ErrorTextCalls("notFound"); 

        }  **else**  { 
            SaveDataToDatabase(); 

// wixLocation.to(“https://pronilchakraborty0.wixsite.com/mysite-1/SUMMARY/”+ $w(‘#input1’).value + “/”);
}

    }); 
} 

if ($w(‘#dropdown1’).value === ‘xbox’) { //if the user selected xbox from dropdown menu

    getplayerstatusxbox($w('#input1').value).then(res => { 

        console.log(res); 

if (res[0].status_string === ‘Unknown’) { //if username not found according to the Paladins API

            ErrorTextCalls("notFound"); 

        }  **else**  { 
            SaveDataToDatabase(); 
           // wixLocation.to("https://pronilchakraborty0.wixsite.com/mysite-1/SUMMARY/" + $w('#input1').value + "/"); 
        } 
    }); 
} 

if ($w(‘#dropdown1’).value === ‘ps4’) { //if the user selected ps4 from dropdown menu

    getplayerstatusps4($w('#input1').value).then(res => { 

        console.log(res); 

if (res[0].status_string === ‘Unknown’) { //if username not found according to the Paladins API

            ErrorTextCalls("notFound"); 

        }  **else**  { 
            SaveDataToDatabase(); 
          //  wixLocation.to("https://pronilchakraborty0.wixsite.com/mysite-1/SUMMARY/" + $w('#input1').value + "/"); 
        } 
    }); 
} 

}

PS: Sorry for the delayed response