Let the WS handler handle leaving servers

This commit is contained in:
abalabahaha
2016-05-28 21:48:18 -07:00
parent 7cf7c0e794
commit 6bc2750f3d
2 changed files with 178 additions and 238 deletions

View File

@@ -473,15 +473,7 @@ export default class InternalClient {
return Promise.reject(new Error("server did not resolve"));
}
return this.apiRequest("del", Endpoints.ME_SERVER(server.id), true)
.then(() => {
// remove channels of server then the server
for (var chan of server.channels) {
this.channels.remove(chan);
}
// remove server
this.servers.remove(server);
});
return this.apiRequest("del", Endpoints.ME_SERVER(server.id), true);
}
//def deleteServer
@@ -491,15 +483,7 @@ export default class InternalClient {
return Promise.reject(new Error("server did not resolve"));
}
return this.apiRequest("del", Endpoints.SERVER(server.id), true)
.then(() => {
// remove channels of server then the server
for (var chan of server.channels) {
this.channels.remove(chan);
}
// remove server
this.servers.remove(server);
});
return this.apiRequest("del", Endpoints.SERVER(server.id), true);
}
// def loginWithToken