I recently developed a custom Vue plugin which includes a customized instance method
import Echo from 'laravel-echo';
import Vue from 'vue';
import config from '@/config';
const echor = {
install(Vue){
Vue.prototype.$echo = options => {
return new Echo({
// Is there a way to access store values within an instance method?
auth: {
headers: {
Authorization: `${store.state.auth.token.token_type} ${store.state.auth.token.access_token}`
}
}
});
}
}
};
Vue.use(echor);
Any suggestions on how I can retrieve store values within an instance method in order to properly utilize the Authorization
header? I've tried searching online without much success.
Thank you!