async initialize () {
if (this.$route.params.id) {
this.showBreadcrumbs = true
this.headers = [
{
text: nameCol,
align: 'start',
sortable: false,
value: 'title',
},
{ text: createdCol, value: 'created' },
{ text: actionCol, value: 'actions', sortable: false },
]
}
// this.bkItems.push(this.bkRoot);
var result
if (this.$route.params.id) {
result = await this.$api.store.get(this.$route.params.id)
} else {
result = await this.$api.store.fetch()
}
this.desserts = []
if (result.breadcrumbs) {
this.bkItems = result.breadcrumbs
}
if (result.stores) {
result.stores.forEach((element) => {
if (element.created !== 0 || element.created !== '') {
const utc = new Date(element.created * 1000)
const str = moment(utc).format('YYYY-MM-DD')
element.created = str
} else element.created = ''
if (element.openDate !== 0) {
console.log(element.openDate)
const utc = new Date(element.openDate * 1000)
const str = moment(utc).format('YYYY-MM-DD')
element.openDate = str
} else element.openDate = ''
if (element.modified !== 0 || element.modified !== '') {
const utc = new Date(element.modified * 1000)
const str = moment(utc).format('YYYY-MM-DD')
element.modified = str
} else element.modified = ''
})
this.desserts = result.stores
}
},
{
path: 'store/:id?',
name: 'UserStore',
component: () => import('@/views/user/Store.vue'),
},
if (this.$route.params.id) {
result = await this.$api.store.get(this.$route.params.id)
} else {
result = await this.$api.store.fetch()
}