vtb-appit 0.0.79 → 0.0.81
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/appit.js +11 -6
- package/package.json +10 -12
package/appit.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const pth = require("path");
|
|
3
3
|
const https = require('https');
|
|
4
|
+
const FormData = require('form-data');
|
|
5
|
+
const axios = require('axios');
|
|
4
6
|
|
|
5
7
|
class Appit {
|
|
6
8
|
|
|
@@ -926,12 +928,15 @@ class Appit {
|
|
|
926
928
|
formData.append('excursion_id', data.excursion_id);
|
|
927
929
|
if(data.content)
|
|
928
930
|
formData.append('content', data.content);
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
|
|
932
|
+
if(data.file) {
|
|
933
|
+
formData.append('files[id][]', '');
|
|
934
|
+
formData.append('files[title][]', data.title);
|
|
935
|
+
formData.append('files[file][]', fs.createReadStream(data.file));
|
|
936
|
+
}
|
|
937
|
+
let response = false;
|
|
933
938
|
try {
|
|
934
|
-
|
|
939
|
+
response = await axios.post('https://portal.appit4travel.com/api/v1/documents', formData, {
|
|
935
940
|
headers: {
|
|
936
941
|
'Content-Type': `multipart/form-data ${formData.getBoundary()}`,
|
|
937
942
|
Authorization: 'Bearer ' + this.token
|
|
@@ -942,7 +947,7 @@ class Appit {
|
|
|
942
947
|
} catch (error) {
|
|
943
948
|
console.log('error');
|
|
944
949
|
}
|
|
945
|
-
return
|
|
950
|
+
return response.data;
|
|
946
951
|
//return await this.request('POST', `documents`, data);
|
|
947
952
|
}
|
|
948
953
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
}
|
|
2
|
+
"name": "vtb-appit",
|
|
3
|
+
"version": "0.0.81",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"author": "Chris Kanger",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"axios": "^1.6.8"
|
|
13
11
|
}
|
|
14
|
-
|
|
12
|
+
}
|