How to get current userid in frontend tasklist plugin?

Follow the ‘cats’ example, I succeed to bulid a frontend tasklist plugin.
But how can I get current userid in the plugin? I want to do some rest-api require which need the logged useid .
Is there any examples or docs?

Thanks a lot

Finally I get the way , maybe not the best one, but it does work!

render: (node, $rootScope,{ api }) => {
fetch($rootScope.api.adminApi + “/auth/user/default”, {
method: ‘get’,
headers: {
“Accept”: “application/json”,
“Content-Type”: “application/json”,
“X-XSRF-TOKEN”: $rootScope.api.CSRFToken,
},
}).then(async (res) => {
var result = await res.json();
console.log(result.userId);
node.innerHTML = “:”+result.userId+"";
});

}

1 Like

Glad you managed to get something working. :slight_smile: