1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

added api call (not working)

This commit is contained in:
muerwre 2019-08-12 15:39:06 +07:00
parent 92f097d161
commit 7350201e22
3 changed files with 26 additions and 2 deletions

20
src/redux/uploads/api.ts Normal file
View file

@ -0,0 +1,20 @@
import { IResultWithStatus, IFile } from '~/redux/types';
import { api, configWithToken } from '~/utils/api';
import { API } from '~/constants/api';
export const postUploadFile = ({
access,
file,
target = 'others',
type = 'image',
}: {
access: string;
file: File;
target: string;
type: string;
}): Promise<IResultWithStatus<IFile>> => {
const data = new FormData();
data.append('file', file);
return api.post(API.USER.UPLOAD(target, type), data, configWithToken(access));
};