@oxyhq/core 3.4.6 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -599,7 +599,9 @@ export class HttpService {
599
599
  * Build full URL with query params
600
600
  */
601
601
  buildURL(url, params) {
602
- const base = url.startsWith('http') ? url : `${this.baseURL}${url}`;
602
+ const base = /^https?:\/\//i.test(url)
603
+ ? url
604
+ : `${this.baseURL.replace(/\/+$/, '')}/${url.replace(/^\/+/, '')}`;
603
605
  if (!params || Object.keys(params).length === 0) {
604
606
  return base;
605
607
  }
@@ -112,6 +112,12 @@ export class OxyServicesBase {
112
112
  const unsubscribe = this.onTokensChanged(syncToken);
113
113
  client.setAuthRefreshHandler(async (reason) => {
114
114
  const refreshed = await this.httpService.refreshAccessToken(reason);
115
+ if (!refreshed) {
116
+ if (reason === 'response-401') {
117
+ this.clearTokens();
118
+ }
119
+ return null;
120
+ }
115
121
  syncToken(refreshed);
116
122
  return refreshed;
117
123
  });