fix: Fixes issue where self-hosted accounts may not have loaded correct server

This commit is contained in:
Mo
2024-01-06 15:00:41 -06:00
parent 604f341f8f
commit acd20dcc70
4 changed files with 3 additions and 34 deletions

View File

@@ -106,7 +106,6 @@ export class LegacyApiService
private httpService: HttpServiceInterface,
private storageService: DiskStorageService,
private host: string,
private workspaceIdentifier: string,
private inMemoryStore: KeyValueStoreInterface<string>,
private crypto: PureCryptoInterface,
private sessionStorageMapper: MapperInterface<Session, Record<string, unknown>>,
@@ -143,16 +142,14 @@ export class LegacyApiService
}
public loadHost(): string {
const storedValue = this.storageService.getValue<string | undefined>(
`${StorageKey.ServerHost}:${this.workspaceIdentifier}`,
)
const storedValue = this.storageService.getValue<string | undefined>(StorageKey.ServerHost)
this.host = storedValue || this.host
return this.host
}
public async setHost(host: string): Promise<void> {
this.host = host
this.storageService.setValue(`${StorageKey.ServerHost}:${this.workspaceIdentifier}`, host)
this.storageService.setValue(StorageKey.ServerHost, host)
}
public getHost(): string {

View File

@@ -169,7 +169,7 @@ export class SessionManager
}
}
const serverHost = this.storage.getValue<string | undefined>(`${StorageKey.ServerHost}:${this.workspaceIdentifier}`)
const serverHost = this.storage.getValue<string | undefined>(StorageKey.ServerHost)
if (serverHost) {
void this.apiService.setHost(serverHost)
this.httpService.setHost(serverHost)