Add serialisation, ready payload and GET guilds.

This commit is contained in:
Paul Makles
2020-08-12 15:40:56 +02:00
parent 74b4238f04
commit 7e7eb34f65
7 changed files with 314 additions and 125 deletions

View File

@@ -37,6 +37,7 @@ impl Handler for Server {
match state.try_authenticate(self.id.clone(), token.to_string()) {
StateResult::Success(user_id) => {
let user = crate::database::user::fetch_user(&user_id).unwrap().unwrap();
self.user_id = Some(user_id);
self.sender.send(
json!({
@@ -46,14 +47,10 @@ impl Handler for Server {
.to_string(),
)?;
self.user_id = Some(user_id);
self.sender.send(
json!({
"type": "ready",
"data": {
// ! FIXME: rewrite
"user": user,
}
"data": user.create_payload()
})
.to_string(),
)