Commit 6ca441f9 authored by les's avatar les
Browse files

hot fix

parent a9eedb7b
......@@ -80,6 +80,16 @@ export default {
name: 'Admin',
components: { Users, Places, Settings, Federation, Moderation, Announcement },
middleware: ['auth'],
async asyncData ({ $axios, params, store }) {
try {
const users = await $axios.$get('/users')
const events = await $axios.$get('/event/unconfirmed')
return { users, events }
} catch (e) {
console.error(e)
return { users: [], events: [] }
}
},
data () {
return {
perPage: 10,
......@@ -94,15 +104,6 @@ export default {
head () {
return { title: `${this.settings.title} - ${this.$t('common.admin')}` }
},
async asyncData ({ $axios, params, store }) {
try {
const users = await $axios.$get('/users')
const events = await $axios.$get('/event/unconfirmed')
return { users, events }
} catch (e) {
console.error(e)
}
},
computed: {
...mapState(['settings']),
unconfirmedUsers () {
......
......@@ -151,6 +151,7 @@ const eventController = {
const notifier = require('../../notifier')
notifier.notifyEvent('Create', event.id)
} catch (e) {
debug(e)
res.sendStatus(404)
}
},
......@@ -167,22 +168,28 @@ const eventController = {
await event.update({ is_visible: false })
res.sendStatus(200)
} catch (e) {
debug(e)
res.sendStatus(404)
}
},
/** get all unconfirmed events */
async getUnconfirmed (req, res) {
const events = await Event.findAll({
where: {
parentId: null,
is_visible: false,
start_datetime: { [Op.gt]: moment.unix() }
},
order: [['start_datetime', 'ASC']],
include: [Tag, Place]
})
res.json(events)
try {
const events = await Event.findAll({
where: {
parentId: null,
is_visible: false,
start_datetime: { [Op.gt]: moment().unix() }
},
order: [['start_datetime', 'ASC']],
include: [{ model: Tag, required: false }, Place]
})
res.json(events)
} catch (e) {
debug(e)
res.sendStatus(400)
}
},
async addNotification (req, res) {
......@@ -280,8 +287,8 @@ const eventController = {
const notifier = require('../../notifier')
notifier.notifyEvent('Create', event.id)
} catch (e) {
res.sendStatus(400)
debug(e)
res.sendStatus(400)
}
},
......@@ -331,7 +338,7 @@ const eventController = {
defaults: { address: body.place_address }
}).spread((place, created) => place)
} catch (e) {
console.log('error', e)
debug(e)
}
await event.setPlace(place)
await event.setTags([])
......@@ -376,7 +383,7 @@ const eventController = {
}
},
async _select (start = moment.unix(), limit = 100) {
async _select (start = moment().unix(), limit = 100) {
const where = {
// confirmed event only
recurrent: null,
......
......@@ -1231,16 +1231,6 @@
consola "^2.5.6"
http-proxy-middleware "^0.19.1"
"@nuxtjs/universal-storage@^0.5.5":
version "0.5.5"
resolved "https://registry.yarnpkg.com/@nuxtjs/universal-storage/-/universal-storage-0.5.5.tgz#356685c36bd84a557560c868458f9334b6e7eb0a"
integrity sha512-/M7cdkCzB8tG4X/NyhqW9lDSRVp9x9+yvkqP8lJIR+5iQFQM9O5toMpHBlwJ9l6aKiBK5ckwqQk5bIKHaM6Isw==
dependencies:
"@types/cookie" "^0.3.3"
cookie "^0.4.1"
dotprop "^1.2.0"
uri-js "^4.2.2"
"@nuxtjs/youch@^4.2.3":
version "4.2.3"
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
......@@ -1284,11 +1274,6 @@
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
"@types/cookie@^0.3.3":
version "0.3.3"
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.3.3.tgz#85bc74ba782fb7aa3a514d11767832b0e3bc6803"
integrity sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==
"@types/json-schema@^7.0.3":
version "7.0.4"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
......@@ -3064,11 +3049,6 @@ cookie@^0.3.1:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
cookie@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1"
integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==
copy-concurrently@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/copy-concurrently/-/copy-concurrently-1.0.5.tgz#92297398cae34937fcafd6ec8139c18051f0b5e0"
......@@ -3815,11 +3795,6 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"
dotprop@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/dotprop/-/dotprop-1.2.0.tgz#8fdf345c757da479ec8af218ae4239a73df721a7"
integrity sha512-mVQb8y5u3UkzNua2Hc8Ut/uKyCjm9GG2MRk/0fxJ9Mxo8Nb8XyWqaP0wVXerMucmu0mQmlcZm3S1mjOdcbCwQA==
dottie@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.2.tgz#cc91c0726ce3a054ebf11c55fbc92a7f266dd154"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment