jeudi 15 octobre 2020

How to pass data from action in controller, to the handlebar template in Ember

My application.js controller has @actions for sending POST requests, and I want to take the json payload response from one of these actions, and use that json payload in my .hbs file called application.hbs.

@action async myFunctionn() {
    let response = await fetch(url, {
        method: 'POST',
        headers:{'Content-Type':'application/vnd.api+json'},
    },
    body:JSON.stringify(payload)});

    let json = await response.json();
    return;


}

How can I most simply do this.




Aucun commentaire:

Enregistrer un commentaire