const ViewDate = { data () { return { form: false, data: {}, } }, created () { self = this; self.refresh() }, watch: { '$route': 'refresh' }, methods: { refresh() { getJSON(`//${location.host}${location.pathname}api/date/`+self.$route.params.id).then(function(data){ self.data = data; }) }, openAdd() { self.form = true; self.edit.id = 0; }, send() { if (self.edit.id === 0) { httpJSON(`//${location.host}${location.pathname}api/date`,'POST', self.edit) .then(function(data) { self.form = false; }, function (err) { alert("unable to add new date:" + err.message); }) } }, }, template: `

Termin: {{new Date(data.date).toDateString()}} {{$route.params.id}}

Datum Personen
`, }