fix redirects, fix server syncs on join

This commit is contained in:
Katalina / stardust 2018-01-17 23:12:11 -06:00
parent 032831aff1
commit f7238ab091
14 changed files with 132 additions and 101 deletions

View file

@ -7,7 +7,7 @@ module.exports = (R, $) => {
ctx.body = presentable
} catch (e) {
console.error(e.trace)
console.error(e.trace || e.stack)
}
})
@ -29,6 +29,23 @@ module.exports = (R, $) => {
ctx.body = server
})
R.get('/api/server/:id/slug', async (ctx) => {
const { userId } = ctx.session
const { id } = ctx.params
const srv = $.discord.client.guilds.get(id)
console.log(srv)
if (srv == null) {
ctx.body = { err: 'not found' }
ctx.status = 404
return
}
ctx.body = await $.P.serverSlug(srv)
})
R.patch('/api/server/:id', async (ctx) => {
const { userId } = ctx.session
const { id } = ctx.params