1
0
Fork 0
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:
Fedor Katurov 2021-03-03 12:20:21 +07:00
parent 4da55dcd21
commit 7031084b09
7 changed files with 130 additions and 140 deletions

View file

@ -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);
};