@putkoff/abstract-utilities 0.1.1 → 0.1.101

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/dist/cjs/index.js CHANGED
@@ -1176,15 +1176,22 @@ function requestPatch(url_1) {
1176
1176
  // Performs PATCH request for file sharing
1177
1177
  function fetchSharePatch(file) {
1178
1178
  return __awaiter(this, void 0, void 0, function* () {
1179
- const url = getAppConfig('/files/share');
1179
+ const cleanEndpoint = '/files/share';
1180
+ const baseUrl = getAppConfig(cleanEndpoint);
1181
+ const baseSlices = baseUrl.split("/").filter(Boolean);
1182
+ // build final URL
1183
+ const url = ensureAbstractUrl(cleanEndpoint, baseSlices);
1180
1184
  const token = localStorage.getItem('token');
1185
+ const body = JSON.stringify(file);
1186
+ const method = 'PATCH';
1187
+ const headers = {
1188
+ 'Content-Type': 'application/json',
1189
+ 'Authorization': `Bearer ${token}`,
1190
+ };
1181
1191
  const resp = yield fetch(url, {
1182
- method: 'PATCH',
1183
- headers: {
1184
- 'Content-Type': 'application/json',
1185
- 'Authorization': `Bearer ${token}`,
1186
- },
1187
- body: JSON.stringify(file),
1192
+ method,
1193
+ headers,
1194
+ body
1188
1195
  });
1189
1196
  if (!resp.ok) {
1190
1197
  console.error('Error from server', yield resp.text());