I want to make separate class for axios requests, which works like "service"
Vue component:
<template>
<div v-for="user in users">
{{ user.firstname }} - {{ user.lastname }} - {{ user.middlename }}
</div>
</template>
<script>
import ConnectionService from './ConnectionService';
const connectionService = new ConnectionService();
export default {
mounted() {
console.log('Component is mounted');
},
created() {
this.users = connectionService.getSingleInstance('http://laravelapi/user');
console.log("This are users " + this.users);
},
data() {
return {
users: [],
}
}
}
</script>
And the service is the following:
export default class ConnectionService {
getSingleInstance(path) {
console.log('This is path ' + path);
let axios_data = {};
axios.get(path).then(response => axios_data = response.data.result);
console.log('This is data ' + axios_data);
console.log(axios_data);
return axios_data;
}
}
As I can see in my console, I get the data from axios xhr request, but then they are not passed to the Vue Component, because I get empty object in the string console.log("This are users " + this.users);
How to import COnnectionService properly and then use it in Vue Component?
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I have experience in C/C++, Java and JavaScript and over the next 52 hours I need to develop an app that allows bookings at a certain location and for people to accept the booking, similar to Air BnB
There is a need to simulate different key combinationsSuch as ctrl+a ctrl+s ctrl+alt+delete and bind them on the div in the interface
Is there any possible way of getting product attributes such as product title, image link, etc other than using Google Shopping Content?
I just need a hard coded password protected pageI used href to redirect to a page as /admin/user/password: