08.02.2017 Views

vuejs

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Working with real data 104<br />

Well this looks better!<br />

Table renders properly<br />

9.3 Update Data<br />

We used to have a function that allowed the user to vote any story he wanted to. This time we want<br />

each time a story is voted to inform the server, ensuring that story votes are updated in the database<br />

as well.<br />

To update an existing story we have to make an HTTP PATCH or PUT request to api/stories/{storyID}.<br />

Inside the upvoteStory function which is to be created, we are going to make a HTTP call after<br />

we have increased story upvotes. We will pass the newly updated story variable in the Request<br />

Payload in order to update the data in our server.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!