[Gekidou] Awaiting client creation (#5556)

* Awaiting client creation

* Update app/init/network_manager.ts

Co-authored-by: Avinash Lingaloo <>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Avinash Lingaloo
2021-07-20 20:04:35 +04:00
committed by GitHub
parent 801c954673
commit bd0f22fcd1

View File

@@ -54,9 +54,9 @@ class NetworkManager {
public init = async (serverCredentials: ServerCredential[]) => {
for await (const {serverUrl, token} of serverCredentials) {
try {
this.createClient(serverUrl, token);
await this.createClient(serverUrl, token);
} catch (error) {
console.log(error); //eslint-disable-line no-console
console.log('NetworkManager init error', error); //eslint-disable-line no-console
}
}
}
@@ -78,7 +78,6 @@ class NetworkManager {
public createClient = async (serverUrl: string, bearerToken?: string) => {
const config = await this.buildConfig();
const {client} = await getOrCreateAPIClient(serverUrl, config, this.clientErrorEventHandler);
const csrfToken = await getCSRFFromCookie(serverUrl);
this.clients[serverUrl] = new Client(client, serverUrl, bearerToken, csrfToken);