mardi 13 juin 2017

Finding data in a belongs to relationship in ember

I am trying to find the account associated with the current user in an ember project. I am able to get the users id and pass it to a handlebars script via . All my attempts to find an account with this user ID in my model hook, however, have been unsuccessful.

My current model hook in routes/my-account.js:

model (params) {
    let accountID = this.store.query('account', { filter: { user: { id:currentUser} } });
    console.log(accountID.id);
    return this.get('store').findRecord('account', accountID);
  }

accountID is returning as an ember class, but I cannot seem to parse any data from it. How would I go about getting the ID from the returned ember class in order to pass it to my get request?




Aucun commentaire:

Enregistrer un commentaire