dtable-sdk
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -83,2 +83,11 @@ "use strict"; | ||
}, { | ||
key: "getCustomAssetUploadLink", | ||
value: function getCustomAssetUploadLink(parentDir) { | ||
var _this$config4 = this.config, | ||
server = _this$config4.server, | ||
dtableUuid = _this$config4.dtableUuid; | ||
var url = server + '/api/v2.1/dtable-custom-asset/' + dtableUuid + '/upload-link/?parent_dir=' + encodeURIComponent(parentDir); | ||
return this.req.get(url); | ||
} | ||
}, { | ||
key: "uploadImage", | ||
@@ -85,0 +94,0 @@ value: function uploadImage(uploadLink, formData) { |
@@ -28,2 +28,17 @@ "use strict"; | ||
_classCallCheck(this, DTable); | ||
_defineProperty(this, "saveImageToCustomFolder", function (imageBlob, path, callback) { | ||
_this.dtableWebAPI.getCustomAssetUploadLink(path).then(function (res) { | ||
var _res$data = res.data, | ||
upload_link = _res$data.upload_link, | ||
parent_path = _res$data.parent_path, | ||
relative_path = _res$data.relative_path; | ||
var formData = new _formData["default"](); | ||
formData.append('parent_dir', parent_path); | ||
formData.append('relative_path', relative_path); | ||
formData.append('file', imageBlob); | ||
_this.dtableWebAPI.uploadImage(upload_link + '?ret-json=1', formData, function (event) { | ||
callback && callback(event); | ||
}); | ||
}); | ||
}); | ||
_defineProperty(this, "addLink", function (linkId, tableId, otherTableId, rowId, otherRowId) { | ||
@@ -52,3 +67,3 @@ _this.dtableStore.addLink(linkId, tableId, otherTableId, rowId, otherRowId); | ||
var _init = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(config) { | ||
var res, _res$data, app_name, access_token, dtable_uuid, dtable_server, dtable_socket; | ||
var res, _res$data2, app_name, access_token, dtable_uuid, dtable_server, dtable_socket; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -65,3 +80,3 @@ while (1) { | ||
res = _context.sent; | ||
_res$data = res.data, app_name = _res$data.app_name, access_token = _res$data.access_token, dtable_uuid = _res$data.dtable_uuid, dtable_server = _res$data.dtable_server, dtable_socket = _res$data.dtable_socket; | ||
_res$data2 = res.data, app_name = _res$data2.app_name, access_token = _res$data2.access_token, dtable_uuid = _res$data2.dtable_uuid, dtable_server = _res$data2.dtable_server, dtable_socket = _res$data2.dtable_socket; | ||
this.config.appName = app_name; | ||
@@ -68,0 +83,0 @@ this.config.accessToken = access_token; |
{ | ||
"name": "dtable-sdk", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "dtable sdk", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47158
872