Add upload image action
This commit is contained in:
parent
2b107ea51f
commit
a48204ea40
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue