I'm currently working with Laravel 5.8 and Vue.js. I've created a function for handling post/get requests in a more generalized way. However, I'm facing an issue where I am not receiving the expected response from the mixins function. Below is a snippet of my code:
TestComponent.vue
import GeneralMixin from '../mixins.js';
export default {
mixins: [GeneralMixin],
methods:{
login: function (e) {
let response;
response = this.testMixin();
console.log(response);
}
}
}
mixin.js
export default {
methods: {
testMixin: function () {
url = '/test';
axios.post(url).then(function(response, status, request) {
return response;
});
}
}
}
The result in the console is undefined
I'm struggling to get the response from the testMixin()
function. Any help would be greatly appreciated!