From 697279f7fd5d6571a3a7599fb51ba57af2aa8945 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 22 Aug 2020 01:22:51 +0300 Subject: refactor: move compressFile to utils --- src/hooks/useS3Preupload.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/hooks') diff --git a/src/hooks/useS3Preupload.tsx b/src/hooks/useS3Preupload.tsx index 651bfb6..9516459 100644 --- a/src/hooks/useS3Preupload.tsx +++ b/src/hooks/useS3Preupload.tsx @@ -1,9 +1,8 @@ import { useState, useCallback, useMemo } from 'react'; import axios from 'axios'; import Bluebird from 'bluebird'; -import Compressor from 'compressorjs'; import { get } from '../requests'; - +import { compressFile } from '../utils/files'; interface ProgressEvent { loaded: number; @@ -17,17 +16,6 @@ interface Hook { progress: number; } - -const compressFile = (file: File, quality = 0.6): Promise => { - return new Promise((resolve, reject) => { - return new Compressor(file, { - success: result => resolve(result), - error: err => reject(err), - quality - }); - }); -}; - export default (): Hook => { const [url, setUrl] = useState(); const [file, setFile] = useState(); -- cgit v1.2.3