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

@@ -27,6 +27,8 @@ export class RestClient
extends BaseClient<typeof fetch, RequestInit, (url: string, data: any) => Promise<Response>>
implements IRestClient
{
protected client!: typeof fetch;
private config: RequestInit = {
credentials: 'include',
};
@@ -78,7 +80,13 @@ export class RestClient
return result;
};
protected override createClient(): void {
constructor() {
super();
this.createClient();
}
private createClient(): void {
this.client = fetch.bind(window);
}