Accept owner invites - help with Ember #1066
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently working on deployable chunk 2 of issue #924, looking for some Ember help. When submitting the
PUT
request to the backend we're using ember-ajax to send thecrate_owner_invitation
struct back to be used in the functionaccept_invite
, written as follows inapp/controllers/me/pending-invites.js
:From the frontend route
/me/pending_invites
we're submitting aPUT
request to the backend route/api/v1/me/accept_owner_invite
. As written it feels like fighting Ember - not using themodel.save()
functions or interacting with the store as seem to usually be done. We only really need to have thecrate_id
to do what we need to do on the backend side of things, is there a better way to send just thecrate_id
? Is there a more idiomatic way to submit requests while specifying the route? I'm under the impression thatmodel.save()
doesn't work here as we have to specify the route to submit the request to, but I'm likely wrong about that. As written this currently works, it just feels like there should be a better way to do it.Another pain point is refreshing the page after the invitation has been accepted to reveal the updated list of pending invites - I've tried using
this.refresh()
andthis.reset()
after calling the ajaxPUT
function but neither seem to do anything - is there a 'typical' way to get the updated model from the store or backend following an action?Feedback from anyone with some experience in Ember would be greatly appreciated!