fix foreach singleton problem

This commit is contained in:
Ulf Gebhardt 2023-03-14 23:43:31 +01:00
parent fc6d64af59
commit 3af7239d5e
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -26,11 +26,10 @@ export class GraphQLGetClient extends GraphQLClient {
* just one instance of each subclass around. * just one instance of each subclass around.
*/ */
public static getInstance(url: string): GraphQLGetClient { public static getInstance(url: string): GraphQLGetClient {
GraphQLGetClient.instanceArray.forEach(function (instance) { const instance = GraphQLGetClient.instanceArray.find((instance) => instance.url === url)
if (instance.url === url) { if (instance) {
return instance.client return instance.client
} }
})
const client = new GraphQLGetClient(url, { const client = new GraphQLGetClient(url, {
method: 'GET', method: 'GET',
jsonSerializer: { jsonSerializer: {