top of page
Forum Posts
Veenus Yadav
Apr 30, 2021
In Coding with Velo
I need to retrieve all the bookings done by users and hence I am using this code in backend- import {bookings} from "wix-bookings-backend"; export function queryBookings() {
return bookings
.queryBookings()
.find()
.then((queryResult) => {
console.log(queryResult)
return queryResult.items;
})
.catch((error) => {
return error;
});
} The code runs fine but returns an empty array. Am I doing something wrong? Thanks in advance to anyone who can provide a suggestion or explanation.
0
1
49
Veenus Yadav
Apr 20, 2021
In Coding with Velo
hi there I am trying to apply assignRole() method to assign a member role to new users. I am trying it separately first on a test page with a text box and a button. Please have a look at my page code: import wixUsers from 'wix-users'; import {assignRole} from 'backend/studentdashboard'; let user $w.onReady(function () { user = wixUsers.currentUser; let userEmail; user.getRoles() .then((roles)=>{ let role="" for(var i=0;i<roles.length;i++){ role=role+roles[i].name+" " console.log(role) $w("#text64").text=role; } }); }); export function button1_click(event) { let roleId='704ea06d-e0fa-4863-be1a-f8320ef2d1e6' let userId=user.id; assignRole(roleId,userId).then(resp => { console.log(resp); }) .catch(error => { console.log(error); }); } My backend code looks like this: import {roles} from 'wix-users-backend'; export function assignRole(roleId, memberId) { return roles.assignRole(roleId, memberId, { suppressAuth: false }) .then( () => { console.log("Role assigned to member"); }) .catch((error) => { console.log(error); }); } Please look at this. Seems like assignRole is not working. I have gone through all the community posts related to this but unable to find a solution. Any help is hugely appreciated.
0
10
141
Veenus Yadav
Mar 22, 2021
In Coding with Velo
0
2
20
Veenus Yadav
More actions
bottom of page