Terminate gql subscription on server address change

Otherwise, the subscription is still active for the old server instead of connecting to the new server
This commit is contained in:
schroda
2024-08-25 22:34:01 +02:00
parent 114f9fd34f
commit 08866ace3d
4 changed files with 23 additions and 12 deletions

View File

@@ -9,14 +9,10 @@
import { AppStorage } from '@/util/AppStorage.ts';
export abstract class BaseClient<Client, ClientConfig, Fetcher> {
protected client!: Client;
protected abstract client: Client;
public abstract readonly fetcher: Fetcher;
constructor() {
this.createClient();
}
public getBaseUrl(): string {
const { hostname, port, protocol } = window.location;
@@ -25,7 +21,5 @@ export abstract class BaseClient<Client, ClientConfig, Fetcher> {
return AppStorage.local.getItemParsed('serverBaseURL', `${protocol}//${hostname}:${inferredPort}`);
}
protected abstract createClient(): void;
public abstract updateConfig(config: Partial<ClientConfig>): void;
}