You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
414 B
16 lines
414 B
/**
|
|
* This is a mini-SDK to submit files upload to imgpush
|
|
*/
|
|
import { IMGPUSH_URL } from '@services/constants';
|
|
|
|
export const upload = async (photo) => {
|
|
const formData = new FormData();
|
|
formData.append('file', photo);
|
|
formData.append('fileName', photo.name);
|
|
return fetch(IMGPUSH_URL, { method: 'POST', body: formData })
|
|
.then((ans) => {
|
|
return ans.json();
|
|
})
|
|
.catch(console.log);
|
|
};
|