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