I'm trying to build an extension but i'm stucked with logic.
i've created a div inside 'headerItems'
extend(CommentPost.prototype, 'headerItems', function (items) {
items.add(
"name",
<div className="myname" id="myid"/>
)
})
Now on the same extender i have a FETCH that retrieve a json.
extend(CommentPost.prototype, 'oninit', function () {
const user = app.session.user;
if (user){
fetch("url")
.then((response) => response.json())
.then((data) => {
this.myJson = data; // <--------------i can see the json output with MY (logged in) info
})
}
fetch must retrieve the information for every user, and display the output into that div.
how can i achieve this?