gancio-upstream/pages/embed/list.vue

35 lines
768 B
Vue
Raw Normal View History

<template lang="pug">
2019-05-30 12:04:14 +02:00
List(:events="events" :title='title')
</template>
<script>
import { mapState } from 'vuex'
2019-05-30 12:04:14 +02:00
import List from '../../components/List'
import moment from 'dayjs'
import get from 'lodash/get'
export default {
layout: 'iframe',
2019-05-30 12:04:14 +02:00
components: { List },
2019-07-27 13:05:02 +02:00
data () {
return {
2019-09-11 19:12:24 +02:00
title: ''
2019-07-27 13:05:02 +02:00
}
},
async asyncData ({ query, $axios }) {
const title = query.title
const tags = query.tags
const places = query.places
2019-05-30 12:04:14 +02:00
const now = new Date()
2019-05-30 12:12:51 +02:00
let params = []
2019-09-11 19:12:24 +02:00
if (places) { params.push(`places=${places}`) }
if (tags) { params.push(`tags=${tags}`) }
2019-05-30 12:04:14 +02:00
2019-05-30 12:12:51 +02:00
params = params.length ? `?${params.join('&')}` : ''
const events = await $axios.$get(`/export/json${params}`)
return { events, title }
2019-09-11 19:12:24 +02:00
}
}
</script>