What is the best way to get the user object inside a widget?
api.createWidget("login-button", {
tagName: "button.btn.btn-primary",
html(arg) {
{{IF USER IS LOGGED IN}}
return username;
},
click(arg) {}
);
What is the best way to get the user object inside a widget?
api.createWidget("login-button", {
tagName: "button.btn.btn-primary",
html(arg) {
{{IF USER IS LOGGED IN}}
return username;
},
click(arg) {}
);
You can use:
const user = api.getCurrentUser()
if(user) {
return user.username;
}
More info here: