1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

fixed prettier, eslint?

This commit is contained in:
muerwre 2019-08-07 15:48:17 +07:00
parent 3eafd990cb
commit 3413b22ac2
6 changed files with 70 additions and 20 deletions

View file

@ -10,10 +10,7 @@ export const IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/
export function createUploader<T extends {}, R extends {}>(
callback: (args: any) => any,
payload: R
): [
(args: T) => (args: T & { onProgress: (current: number, total: number) => void }) => any,
EventChannel<any>
] {
): [(args: T) => (args: T & { onProgress: (current: number, total: number) => void }) => any, EventChannel<any>] {
let emit;
const chan = eventChannel(emitter => {
@ -22,9 +19,7 @@ export function createUploader<T extends {}, R extends {}>(
});
const onProgress = (current: number, total: number): void => {
emit(
current >= total ? END : { ...payload, progress: parseFloat((current / total).toFixed(1)) }
);
emit(current >= total ? END : { ...payload, progress: parseFloat((current / total).toFixed(1)) });
};
const wrappedCallback = args => callback({ ...args, onProgress });
@ -45,11 +40,11 @@ export const uploadGetThumb = async file => {
export const fakeUploader = ({
file,
onProgress,
mustSucceed,
mustSucceed
}: {
file: { url?: string; error?: string };
onProgress: (current: number, total: number) => void;
mustSucceed: boolean;
file: { url?: string; error?: string };
onProgress: (current: number, total: number) => void;
mustSucceed: boolean;
}): Promise<IResultWithStatus<IFile>> => {
const { url, error } = file;