diff --git a/ui/src/actions/AppAction.js b/ui/src/actions/AppAction.js index c70a5a2..69df5a8 100644 --- a/ui/src/actions/AppAction.js +++ b/ui/src/actions/AppAction.js @@ -18,10 +18,22 @@ export function deleteApp(id) { } /** - * Create an application + * Create an application. * @param {string} name the application name * @param {string} description the description of the application. */ export function createApp(name, description) { axios.post(config.get('url') + 'application', {name, description}).then(fetchApps); } + +/** + * Upload an image for an application. + * @param {int} id the application id + * @param {Blob} file the description of the application. + */ +export function uploadImage(id, file) { + const formData = new FormData(); + formData.append('file', file); + axios.post(config.get('url') + 'application/' + id + '/image', formData, + {headers: {'content-type': 'multipart/form-data'}}).then(fetchApps); +}