mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
cleanup
This commit is contained in:
parent
4a3de2ab01
commit
69c7b71237
4 changed files with 9 additions and 14 deletions
|
@ -33,11 +33,13 @@ export function createUploader<T extends {}, R extends {}>(
|
|||
export const uploadGetThumb = async file => {
|
||||
if (!file.type || !VALIDATORS.IS_IMAGE_MIME(file.type)) return '';
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
const thumb = await new Promise(resolve => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result || '');
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
|
||||
return thumb;
|
||||
};
|
||||
|
||||
export const fakeUploader = ({
|
||||
|
@ -49,7 +51,7 @@ export const fakeUploader = ({
|
|||
onProgress: (current: number, total: number) => void;
|
||||
mustSucceed: boolean;
|
||||
}): Promise<IResultWithStatus<IFile>> => {
|
||||
const { url, error } = file;
|
||||
const { error } = file;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue