From ac3910ac8fa3a85a145ac9b452acb4f05a1dfa06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Tue, 29 Oct 2024 22:51:35 +0100 Subject: [PATCH] pl-api: bump version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- packages/pl-api/lib/client.ts | 11 +++++++++-- packages/pl-api/package.json | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/pl-api/lib/client.ts b/packages/pl-api/lib/client.ts index 456e19448..5fa25d3bf 100644 --- a/packages/pl-api/lib/client.ts +++ b/packages/pl-api/lib/client.ts @@ -248,9 +248,16 @@ class PlApiClient { close: () => void; }; - constructor(baseURL: string, accessToken?: string, { instance, fetchInstance }: { + constructor(baseURL: string, accessToken?: string, { + instance, + fetchInstance, + onInstanceFetchSuccess, + onInstanceFetchError, + }: { instance?: Instance; fetchInstance?: boolean; + onInstanceFetchSuccess?: (instance: Instance) => void; + onInstanceFetchError?: (error?: any) => void; } = {}) { this.baseURL = baseURL; this.#accessToken = accessToken; @@ -259,7 +266,7 @@ class PlApiClient { this.#setInstance(instance); } if (fetchInstance) { - this.instance.getInstance(); + this.instance.getInstance().then(onInstanceFetchSuccess).catch(onInstanceFetchError); } } diff --git a/packages/pl-api/package.json b/packages/pl-api/package.json index aa8c0c3fc..f3ba161d5 100644 --- a/packages/pl-api/package.json +++ b/packages/pl-api/package.json @@ -1,6 +1,6 @@ { "name": "pl-api", - "version": "0.1.5", + "version": "0.1.6", "type": "module", "homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-api", "repository": {