[FIX] Remove servers offline from server list (#4286)

This commit is contained in:
Reinaldo Neto 2022-06-21 16:40:29 -03:00 committed by GitHub
parent a5a45f533b
commit 9985e9baf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -81,15 +81,19 @@ export async function removeServer({ server }: { server: string }): Promise<void
if (userId) {
const resume = UserPreferences.getString(`${TOKEN_KEY}-${userId}`);
const sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: isSsl(server) });
await sdk.login({ resume });
try {
const sdk = new RocketchatClient({ host: server, protocol: 'ddp', useSsl: isSsl(server) });
await sdk.login({ resume });
const token = getDeviceToken();
if (token) {
await sdk.del('push.token', { token });
const token = getDeviceToken();
if (token) {
await sdk.del('push.token', { token });
}
await sdk.logout();
} catch (e) {
log(e);
}
await sdk.logout();
}
await removeServerData({ server });