<script>
import axios from 'axios'
export default {
data () {
return {
center: {lat: 45.101637, lng: 38.986345},
markers: []
}
},
mounted() {
let vm = this
vm.getMarkers();
},
methods: {
getMarkers() {
let vm = this
axios.get('/api/markers')
.then(function(response) {
vm.markers = response.data.data.map(m => {
return {
name: m.name,
address: m.address,
position: { lat: m.lat, lng: m.lng }
}
})
},
}
}
</script>
<carousel :key="screenWidth">
router.beforeEach((to, from, next) => {
const authUser = $store.state.auth
const publicPages = ['/login']
const authRequired = !publicPages.includes(to.path)
if (authRequired && !authUser) {
next('/login')
}
if (to.path === '/login' && authUser) {
return next('/panel')
}
next()
});
https://codepen.io/iolega/pen/xxExeVo