Add upload image action

This commit is contained in:
Jannis Mattheis 2018-03-30 19:33:59 +02:00 committed by Jannis Mattheis
parent 2b107ea51f
commit a48204ea40
1 changed files with 13 additions and 1 deletions

View File

@ -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);
}