UNPKG

@api-platform/client-generator

Version:

Generate apps built with Next, Nuxt, Quasar, React, React Native, Vue or Vuetify for any API documented using Hydra or OpenAPI

43 lines (41 loc) 984 B
import NotificationMixin from './NotificationMixin'; import { formatDateTime } from '../utils/dates'; export default { mixins: [NotificationMixin], created() { this.retrieve(decodeURIComponent(this.$route.params.id)); }, computed: { item() { return this.find(decodeURIComponent(this.$route.params.id)); } }, methods: { del() { this.deleteItem(this.item).then(() => { this.showMessage(`${this.item['@id']} deleted.`); this.$router .push({ name: `${this.$options.servicePrefix}List` }) .catch(() => {}); }); }, formatDateTime, editHandler() { this.$router.push({ name: `${this.$options.servicePrefix}Update`, params: { id: this.item['@id'] } }); } }, watch: { error(message) { message && this.showError(message); }, deleteError(message) { message && this.showError(message); } }, beforeDestroy() { this.reset(); } };