I have a back end http function which inserts into a database. After which the front end has an after insert hook for that database but it never gets triggered. After #IRISidCommands has saved, the IRISid username field needs to be read but nothing is happening. Can anyone please help?
import wixData from “wix-data”;
import wixLocation from “wix-location”;
let clients = ;
$w.onReady( function () {
$w(“#IRISidCommands”).onReady(() => {
$w(“#IRISidCommands”).setFieldValue(“title”, “1”);
$w(“#IRISidCommands”).setFieldValue(“command”, “identify”);
$w(“#IRISidCommands”).setFieldValue(“params”, “null”);
$w(“#IRISidCommands”).save()
.then(() => {
console.log(“Sent identify command to IRIS device”);
})
. catch ((err) => {
let errMsg = err;
});
});
//Open patient page after identified by IRIS device
$w(“#IRISid”).onReady(() => {
let count = $w(“#IRISid”).getTotalCount();
console.log("Total items in IRISid : " + count);
});
$w("#IRISid").onAfterSave(() => {
console.log("IRISid onAfterSave() called");
});
});
export async function IRISid_beforeInsert(item, context) {
console.log(“IRISid_beforeInsert called()”);
return Promise.resolve(item);
}
export async function IRISid_afterInsert(item, context) {
console.log(“IRISid_afterInsert() called”);
let it = wixData.get(“#IRISid”, “username”)
.then((vID) => {
wixLocation.to(“/interface/account/patients/:vID”);
})
. catch ((err) =>{
let errorMsg = err;
})
}