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)
},
})
Source:stackexchange.com