fix: fix profile type

This commit is contained in:
SD 2024-03-27 18:23:36 +04:00
parent 6232330f2e
commit 42eae6cba2
1 changed files with 14 additions and 14 deletions

View File

@ -2,7 +2,7 @@
import React, { FC, useEffect, useState } from 'react';
import { Form, Upload, Button } from 'antd';
import type { UploadFile, UploadProps, GetProp } from 'antd';
import type { UploadFile, UploadProps } from 'antd';
import ImgCrop from 'antd-img-crop';
import { CameraOutlined } from '@ant-design/icons';
import { Link } from '../../navigation';
@ -21,7 +21,7 @@ type ProfileSettingsProps = {
saveButton?: string;
};
type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
// type FileType = Parameters<GetProp<UploadProps, 'beforeUpload'>>[0];
export const ProfileSettings: FC<ProfileSettingsProps> = ({
locale,
@ -49,18 +49,18 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({
};
const onPreview = async (file: UploadFile) => {
let src = file.url as string;
if (!src) {
src = await new Promise((resolve) => {
const reader = new FileReader();
reader.readAsDataURL(file.originFileObj as FileType);
reader.onload = () => resolve(reader.result as string);
});
}
const image = new Image();
image.src = src;
const imgWindow = window.open(src);
imgWindow?.document.write(image.outerHTML);
// let src = file.url as string;
// if (!src) {
// src = await new Promise((resolve) => {
// const reader = new FileReader();
// reader.readAsDataURL(file.originFileObj as FileType);
// reader.onload = () => resolve(reader.result as string);
// });
// }
// const image = new Image();
// image.src = src;
// const imgWindow = window.open(src);
// imgWindow?.document.write(image.outerHTML);
};
return (