mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-26 05:16:41 +07:00
player: renamed apiGetEmbedYoutube
This commit is contained in:
parent
4da55dcd21
commit
7031084b09
7 changed files with 130 additions and 140 deletions
|
@ -1,31 +1,20 @@
|
|||
import {
|
||||
IResultWithStatus, IFile, IUploadProgressHandler, IFileWithUUID,
|
||||
} from '~/redux/types';
|
||||
import {
|
||||
api, configWithToken, resultMiddleware, errorMiddleware,
|
||||
} from '~/utils/api';
|
||||
import { api, cleanResult } from '~/utils/api';
|
||||
|
||||
import { API } from '~/constants/api';
|
||||
import { ApiUploadFileRequest, ApiUploadFIleResult } from '~/redux/uploads/types';
|
||||
|
||||
export const postUploadFile = ({
|
||||
access,
|
||||
export const apiUploadFile = ({
|
||||
file,
|
||||
target = 'others',
|
||||
type = 'image',
|
||||
onProgress,
|
||||
}: IFileWithUUID & {
|
||||
access: string;
|
||||
onProgress: IUploadProgressHandler;
|
||||
}): Promise<IResultWithStatus<IFile>> => {
|
||||
}: ApiUploadFileRequest) => {
|
||||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
|
||||
return api
|
||||
.post(
|
||||
API.USER.UPLOAD(target, type),
|
||||
data,
|
||||
configWithToken(access, { onUploadProgress: onProgress })
|
||||
)
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
.post<ApiUploadFIleResult>(API.USER.UPLOAD(target, type), data, {
|
||||
onUploadProgress: onProgress,
|
||||
})
|
||||
.then(cleanResult);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue