I'm trying to use a service globally in my Nuxt app. I've created my service, put it in a plugins and called it in my nuxt config, but I get this error. I'm not sure how to make it works.
services/backendConnector.js
const backendConnector = {
getReviews() {
return fetch(`${baseUrl}/reviews`);
},
more functions like this one ...
}
export default backendConnector;
/plugins/backendConnector.plugin.js
// eslint-disable-next-line import/no-extraneous-dependencies
import Vue from 'vue';
import backendConnector from '@/services/backendConnector';
Vue.prototype.$backendConnector = backendConnector;
nuxt.config.js
plugins: [
'@/plugins/backendConnector.plugin.js',
]