- Create a JSW-Backend-file.
- Paste this code to the created back-end-file…(call it like you want —> USER )
import wixUsersBackend from 'wix-users-backend';
export function getUser(userID) {
return wixUsersBackend.getUser(userID)
.then((userData) => {
return userData;
});
}
- Paste this code to front-end…
import { getUser } from 'backend/USER.jsw'
$w.onReady(async()=>{
$w('#myButton).onClick(()=>{
let myUserData = await getUser(userID); concole.log(myUserData)
});
});
Of course you have first to get the USER-ID!