[Vuejs]-How to export object of functions to another object of function javascript (nuxt)?

0πŸ‘

βœ…

In shared.js:

export default ({ $axios, target }) => ({
  index: async ({ endpoint }) => await $axios.get(endpoint)
})

In index.js:

import shared from './shared.js'

export default ({ $axios, target }) => ({
  ...shared({ $axios, target }),
  async specificFunction({ endpoint }) { // Function that is specific to this file
    return await $axios.get(endpoint/specific)
  },
})

Leave a comment