diff options
author | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
commit | 3aa87cc26fd58836b82c067b58a47e08e30a7784 (patch) | |
tree | ba9cf1918d210896ab10bed484a8ddf7c7935e0c /Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx | |
parent | 1e90a93049cd57098608de72f02bfaabfadd32b6 (diff) | |
download | timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.gz timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.bz2 timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.zip |
refactor(front): Make codes lint-clean!
Diffstat (limited to 'Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx')
-rw-r--r-- | Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx b/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx index e082d5a0..f7b25252 100644 --- a/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx +++ b/Timeline/ClientApp/src/user/ChangeAvatarDialog.tsx @@ -11,6 +11,7 @@ import { import { AxiosError } from 'axios';
import ImageCropper, { Clip, applyClipToImage } from '../common/ImageCropper';
+import { UiLogicError } from '../common';
export interface ChangeAvatarDialogProps {
open: boolean;
@@ -107,11 +108,11 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => { clip.width === 0 ||
file == null
) {
- throw new Error('Invalid state.');
+ throw new UiLogicError();
}
setState('processcrop');
- applyClipToImage(cropImgElement, clip, file.type).then((b) => {
+ void applyClipToImage(cropImgElement, clip, file.type).then((b) => {
setResultBlob(b);
});
}, [cropImgElement, clip, file]);
@@ -130,7 +131,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => { const upload = React.useCallback(() => {
if (resultBlob == null) {
- throw new Error('Invalid state.');
+ throw new UiLogicError();
}
setState('uploading');
@@ -147,7 +148,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => { const createPreviewRow = (): React.ReactElement => {
if (resultUrl == null) {
- throw new Error('Invalid state.');
+ throw new UiLogicError();
}
return (
<Row className="justify-content-center">
@@ -182,7 +183,7 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => { );
} else if (state === 'crop') {
if (fileUrl == null) {
- throw new Error('Invalid state.');
+ throw new UiLogicError();
}
return (
<>
|