javascript - emberJS 2 : nested relationships resources for actions (update & delete) -


i'm asking relationships ember data.

i have user belongs account , cloud. datas associated urls.

the api done :

get users/:id -> send user

get users/:id/account -> send account status infos

get users/:id/cloud -> send cloud status infos

what need :

i need able update account , cloud using user id info. api expects :

patch users/:id -> update user

patch users/:id/account -> update account associated userid. userid enough in api side, can if necessary send account id -> users/:id/account/:idaccount

the same urls delete http method delete accounts.

when trigger "model.get('account').get('content').save() sends

accounts/:idaccount

but our api doesn't work this...

do have idea how manage ?

thanks lot !

if you're using ember-data's jsonapiadapter or other restadapter, want override urlforupdaterecord. snapshot.prototype.belongsto useful. i'd guess like

// app/adapters/account.js: urlforupdaterecord(id, modelname, snapshot) {   const userid = snapshot.belongsto('user', { id: true });   return `/users/${userid}/account`; } 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -