first bits of redux

This commit is contained in:
41666 2019-03-20 09:25:28 -05:00
parent 9c7f7fda73
commit def2b0d2a3
13 changed files with 170 additions and 16 deletions

View file

@ -20,5 +20,28 @@ export default ($: AppContext) => ({
}
return $.P.serverSlug(srv)
},
getServer (ctx: Context, id: string) {
const { userId } = (ctx.session: { userId: string })
const srv = $.discord.client.guilds.get(id)
if (srv == null) {
return { err: 'not_found' }
}
let gm
if (srv.members.has(userId)) {
gm = $.discord.gm(id, userId)
} else if ($.discord.isRoot(userId)) {
// gm = $.discord.fakeGm({ id: userId })
}
if (gm == null) {
return { err: 'not_found' }
}
return $.P.presentableServer(srv, gm)
}
})