Skip to content

Commit

Permalink
fix(rest): modify for uploading operation
Browse files Browse the repository at this point in the history
  • Loading branch information
zack9433 committed Oct 14, 2016
1 parent c813763 commit 972fee7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/component/restful.provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ class RestProvider {
post: (uri, data, files, options) => {
if ('http' === config.service && Array.isArray(files)) {
options = options || {};
let base = options.basePath || config.basePath;
return Upload.upload({
const base = options.basePath || config.basePath;
let setting = {
url: base + uri,
method: 'POST',
data: {
files: files,
otherInfo: data
}
});
};
return Upload.upload(Object.assign(setting, options));
}
else {
return makeRequest('post', uri, data, options);
Expand All @@ -41,15 +42,16 @@ class RestProvider {
put: (uri, data, files, options) => {
if ('http' === config.service && Array.isArray(files)) {
options = options || {};
let base = options.basePath || config.basePath;
return Upload.upload({
const base = options.basePath || config.basePath;
let setting = {
url: base + uri,
method: 'PUT',
data: {
files: files,
otherInfo: data
}
});
};
return Upload.upload(Object.assign(setting, options));
}
else {
return makeRequest('put', uri, data, options);
Expand Down

0 comments on commit 972fee7

Please sign in to comment.