polfan-server-js-client 0.2.37 → 0.2.38
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/.idea/workspace.xml +13 -6
- package/build/index.cjs.js +4 -4
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/FilesClient.ts +4 -4
package/package.json
CHANGED
package/src/FilesClient.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface File {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class FilesClient extends AbstractRestClient {
|
|
14
|
-
protected defaultUrl: string = 'https://files.devana.pl
|
|
14
|
+
protected defaultUrl: string = 'https://files.devana.pl';
|
|
15
15
|
|
|
16
16
|
public async uploadFile(file: Parameters<typeof FormData.prototype.append>[1]): Promise<RestClientResponse<File>> {
|
|
17
17
|
const formData = new FormData();
|
|
@@ -19,18 +19,18 @@ export class FilesClient extends AbstractRestClient {
|
|
|
19
19
|
|
|
20
20
|
let headers = {...this.getAuthHeaders(), Accept: 'application/json'};
|
|
21
21
|
|
|
22
|
-
const response = await fetch(this.
|
|
22
|
+
const response = await fetch(this.getUrl('files'), {method: 'POST', body: formData, headers});
|
|
23
23
|
|
|
24
24
|
return this.convertFetchResponse<File>(response);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public async getFileMeta(id: string): Promise<RestClientResponse<File>> {
|
|
28
|
-
return this.send('GET', '/' + id);
|
|
28
|
+
return this.send('GET', 'files/' + id);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
public async getFileMetaBulk(ids: string[]): Promise<RestClientResponse<File[]>> {
|
|
32
32
|
const searchParams = new URLSearchParams();
|
|
33
33
|
ids.forEach(id => searchParams.append('id[]', id));
|
|
34
|
-
return this.send('GET', '?' + searchParams);
|
|
34
|
+
return this.send('GET', 'files?' + searchParams);
|
|
35
35
|
}
|
|
36
36
|
}
|