Patch request in vuejs axios jwt | extrovert.dev -->

Patch request in vuejs axios jwt

Patch request in vuejs axios jwt
Saturday, December 26, 2020

Why patch instead of post request? Patch request is helpful when you need to replace the existing resource partially. For Instance, when updating a single field of resource, sending complete API resource to the server is clunky. Let me make it easy, for example, there is a user profile model having a username, email, and avatar as fields. Now let's say the user might want to update his avatar, In this case, we don't want to send the entire model fields since it makes a heavy request, instead, we update only the avatar field. The patch makes it easy for us.

Patch request in vuejs axios jwt


Let's create an input field within the template

Now create methods for button click and upload Image event.

Here avatar is the API name field holding the avatar url.

Thanks for reading !! 


 


0 Response to Patch request in vuejs axios jwt

Comments are personally moderated by our team. Promotions are not encouraged.

Post a Comment