@hashrytech/quick-components-kit 0.14.0 → 0.14.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: fix for sending requests without a baseurl
8
+
3
9
  ## 0.14.0
4
10
 
5
11
  ### Minor Changes
@@ -97,7 +97,7 @@ export class ApiClient {
97
97
  * @returns A processed `Request` object ready for `fetch`.
98
98
  */
99
99
  async processRequest(endpoint, method, body, options) {
100
- const url = new URL(endpoint, this.baseURL); // Resolve endpoint relative to baseURL
100
+ const url = this.baseURL ? new URL(endpoint, this.baseURL).toString() : endpoint; // Resolve endpoint relative to baseURL
101
101
  const requestHeaders = new Headers(this.defaultHeaders);
102
102
  // Merge custom headers from options using Headers constructor for robustness
103
103
  if (options.headers) {
@@ -133,7 +133,7 @@ export class ApiClient {
133
133
  processedBody = body;
134
134
  }
135
135
  }
136
- let request = new Request(url.toString(), {
136
+ let request = new Request(url, {
137
137
  method: method,
138
138
  headers: requestHeaders,
139
139
  body: processedBody,
@@ -176,11 +176,11 @@ export class ApiClient {
176
176
  }
177
177
  switch (options.responseType) {
178
178
  case 'text':
179
- return (await response.text());
179
+ return await response.text();
180
180
  case 'blob':
181
- return (await response.blob());
181
+ return await response.blob();
182
182
  case 'arrayBuffer':
183
- return (await response.arrayBuffer());
183
+ return await response.arrayBuffer();
184
184
  case 'raw': return response;
185
185
  case 'json':
186
186
  default:
@@ -189,7 +189,7 @@ export class ApiClient {
189
189
  return {}; // Return an empty object for no content
190
190
  }
191
191
  try {
192
- return (await response.json());
192
+ return await response.json();
193
193
  }
194
194
  catch {
195
195
  throw new Error('Failed to parse response as JSON. Response was OK, but not valid JSON.');
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
7
  },
8
- "version": "0.14.0",
8
+ "version": "0.14.1",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [