Skip to content

Instantly share code, notes, and snippets.

@mercs600
Last active March 28, 2020 17:06
Show Gist options
  • Save mercs600/55c912e85428f80e5926482d210d5620 to your computer and use it in GitHub Desktop.
Save mercs600/55c912e85428f80e5926482d210d5620 to your computer and use it in GitHub Desktop.
nuxt-ssr-exercise-3_error-handle
export default {
asyncData: ({ $http, params, error }) => $http
.$get(`https://jsonplaceholder.typicode.com/posts/${params.id}`)
.then(post => ({ post }))
.catch(err => error(err))
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment