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:
parent
92f097d161
commit
7350201e22
3 changed files with 26 additions and 2 deletions
20
src/redux/uploads/api.ts
Normal file
20
src/redux/uploads/api.ts
Normal 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));
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue