Can someone explain to me why I get error in console
app.js:12666 TypeError: Cannot read property 'uuid' of undefined
at Proxy.render (app.js:95774)
at VueComponent.Vue._render (app.js:15384)
at VueComponent.updateComponent (app.js:13674)
at Watcher.get (app.js:14017)
at new Watcher (app.js:14006)
at mountComponent (app.js:13678)
at VueComponent.Vue$3.$mount (app.js:19232)
at VueComponent.Vue$3.$mount (app.js:21567)
at init (app.js:14980)
at createComponent (app.js:16419)
but links that I get in my page are fine?
Vue file looks like this
<template>
<div class="main-container">
<h1 class="page-title">Protocols</h1>
<div class="wrapper">
<router-link :to="`/protocol/${protocolListObject.protocol.uuid}/edit`" class="dropdown-item">Click to edit</router-link>
</div>
</div>
</template>
<script>
import moment from 'moment'
export default {
data() {
return {
protocolListObject: {},
error: {},
}
},
created() {
axios.post('/getSingleProtocol/:uuid')
.then((response) => this.protocolListObject = JSON.parse(response.data))
.catch(error => console.log(error.response));
},
mounted() {
}
}
</script>
and app.js looks like this (I'll remove routes and some things that are irrelevant for this just to make it shorter)
window.Vue = require('vue');
import Vue from 'vue'
import VueRouter from 'vue-router'
import moment from 'moment'
Vue.use(VueRouter)
let ProtocolSummary = Vue.component('protocol-summary', require('./components/ProtocolSummary.vue'));
let ProtocolEdit = Vue.component('protocol-edit', require('./components/ProtocolEdit.vue'));
const routes = [
{ path: '/protocol/:uuid', component: ProtocolSummary },
{ path: '/protocol/:uuid/edit', component: ProtocolEdit },
]
const router = new VueRouter({
mode: 'history',
routes // short for `routes: routes`
})
Vue.prototype.moment = moment
const app = new Vue({
router
}).$mount('#app');
but when I load page I get a link with UUID that I need, but that console error looks terrible and I wanna get rid of it