UNPKG

nuxt-isomorphic-fetch

Version:

Isomorphic access to server-side API in Nuxt.js asyncData

12 lines (11 loc) 248 B
export default function fetcher(opts) { const fetch = opts.client fetch.isomorphic = function (context, ...args) { if (context.isServer) { return opts.server(context, ...args) } else { return opts.client(...args) } } return fetch }