Javascript: How to assign result of asynchronous call

So I'm having a really hard time with this. I'm working on this school project where I have to develop a chat app, where the images of the messages(posts) and the user picture must be fetched through an API, and then saved and stored on the device and loaded from there after the first request.

I've implemented the chat page following the model/view/controller paradigm, my problem is that all posts are save before the user image is assigned to the post.

Log's screenshot

I've tried to use a callback function but it didn't quite work. What can I do?

class ModelChannel {
  constructor() {

    this._posts = []

  }

  savePosts = (response) => {
    var json = JSON.parse(response);
    var post_list = json.posts;

    post_list.forEach(element => {
      var post = {
        uid: element.uid,
        name: element.name,
        pversion: element.pversion,
        pid: element.pid,
        type: element.type,
        content: element.content,
        lat: element.lat,
        lon: element.lon,

        profileImage: this.getProfileImage(sid, element.uid, element, (response) => {
          element.profileImage = response
          console.log("Callback getProfileImage");
          console.log("element.profile: " + element.profileImage);
        }),

      }

      //this.profileImage = this.getProfileImage(sid, element.uid, element)

      this._posts.push(post)
    });

    this.onPostListChanged(this._posts)

    console.log("All posts save into model");
    console.log(this._posts);
  }

  getPosts = (channelName) => {
    comunicationController.getChannel(sid, channelName, (response) => {
      console.log("Call %22getChannel%22 succeded");

      //salva nome canale
      this.savePosts(response)
    })
  }


  getProfileImage = (sid, uid, post, callback) => {
    var profileDB
    databaseHandler.getProfile(uid, (response) => {
      profileDB = JSON.parse(response);

      // if ( profileDB.pversion >= post.pversion){
      if (profileDB != null && profileDB.pversion >= post.pversion) {
        console.log("Profile of " + post.name + " loaded from database");

        //return profileDB.picture
        callback(profileDB.picture)
      } else {
        comunicationController.getUserPicture(sid, uid, (response) => {
          var json = JSON.parse(response);
          var picture = json.picture;

          databaseHandler.saveProfileImage(response)

          //return picture
          callback(picture)
        })
      }
    })

  }

  bindOnPostListChanged(callback) {
    this.onPostListChanged = callback
  }
}