1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +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,7 +1,7 @@
import uuid from 'uuid4';
import { eventChannel, END, EventChannel } from 'redux-saga';
import { END, eventChannel, EventChannel } from 'redux-saga';
import { VALIDATORS } from '~/utils/validators';
import { IResultWithStatus, IFile } from '~/redux/types';
import { IFile, IResultWithStatus } from '~/redux/types';
import { HTTP_RESPONSES } from './api';
import { EMPTY_FILE, FILE_MIMES, UPLOAD_TYPES } from '~/redux/uploads/constants';
@ -33,13 +33,11 @@ export function createUploader<T extends {}, R extends {}>(
export const uploadGetThumb = async file => {
if (!file.type || !VALIDATORS.IS_IMAGE_MIME(file.type)) return '';
const thumb = await new Promise(resolve => {
return new Promise<string | ArrayBuffer>(resolve => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result || '');
reader.readAsDataURL(file);
});
return thumb;
};
export const fakeUploader = ({
@ -73,9 +71,6 @@ export const fakeUploader = ({
});
};
export const getFileType = (file: File): keyof typeof UPLOAD_TYPES => {
return (
(file.type && Object.keys(FILE_MIMES).find(mime => FILE_MIMES[mime].includes(file.type))) ||
null
);
};
export const getFileType = (file: File): keyof typeof UPLOAD_TYPES | undefined =>
(file.type && Object.keys(FILE_MIMES).find(mime => FILE_MIMES[mime].includes(file.type))) ||
undefined;