mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
node api
This commit is contained in:
parent
cad4e683bc
commit
a662256221
4 changed files with 27 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
|||
import {
|
||||
IResultWithStatus, IFile, IUploadProgressHandler, IFileWithUUID,
|
||||
} from '~/redux/types';
|
||||
import { api, configWithToken } from '~/utils/api';
|
||||
import {
|
||||
api, configWithToken, resultMiddleware, errorMiddleware,
|
||||
} from '~/utils/api';
|
||||
|
||||
import { API } from '~/constants/api';
|
||||
|
||||
export const postUploadFile = ({
|
||||
|
@ -16,5 +19,8 @@ export const postUploadFile = ({
|
|||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
|
||||
return api.post(API.USER.UPLOAD(target, type), data, configWithToken(access));
|
||||
return api
|
||||
.post(API.USER.UPLOAD(target, type), data, configWithToken(access))
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue