top of page
Forum Posts
Dafna Kotzer
Jul 10, 2023
In Velo Pro Discussion
Hi,
Get a permission error for data query in events.js.
This is the code:
import wixData from 'wix-data';
import { currentMember } from 'wix-members-backend';
export async function wixPricingPlans_onOrderPurchased(event) {
let lastPaymentStatus = event.data.order.lastPaymentStatus;
let member = await currentMember.getMember({ fieldsets: ['FULL'] })
if (lastPaymentStatus === "PAID") {
let results = await wixData.query("9dbhn5bg4dbx1bh").eq("mail", member.loginEmail).descending("_createdDate").find({ "suppressAuth": true });
console.log("length: " + results.items.length);
if (results.items.length > 0) {
let item = results.items[0];
item.PAID = true;
wixData.save("eebnfj8dbcj8apz", item, { "suppressAuth": true })
.then((item) => {
console.log("paid updates");
})
.catch((err) => {
console.log("save err: " + err);
})
}
}
}
And this is the error:
Will appreciate any help! :)
Dafna
0
1
12
Dafna Kotzer
More actions
bottom of page