const data => {
const files = {};
switch (true) {
case data.length === 1:
files.append('file', data);
return fetcher.post('files', files).id;
case !data.length:
return Promise.resolve([]);
default:
return [];
}
};