Add directory creation

This commit is contained in:
Johannes Zellner
2020-07-09 12:05:14 +02:00
parent c674d679bd
commit 38f3e39258
3 changed files with 95 additions and 1 deletions
+35
View File
@@ -2403,6 +2403,41 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.filesRename = function (appId, path, newPath, callback) {
put('/api/v1/apps/' + appId + '/files/' + path, { newFilePath: newPath }, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));
callback(null, data);
});
};
Client.prototype.filesCreateDirectory = function (appId, path, callback) {
post('/api/v1/apps/' + appId + '/files/' + path, { directory: path }, {}, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));
callback(null, data);
});
};
Client.prototype.filesUploadFile = function (appId, path, file, callback) {
var fd = new FormData();
fd.append('file', file);
var config = {
headers: { 'Content-Type': undefined },
transformRequest: angular.identity
};
post('/api/v1/apps/' + appId + '/files/' + path, fd, config, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));
callback(null, data);
});
};
client = new Client();
return client;
}]);