Fix ts errors with proper implementation

This commit is contained in:
Michael
2021-08-31 14:46:06 +02:00
parent 72c8a5c17a
commit fb86a961c8
2 changed files with 12 additions and 6 deletions

View File

@@ -35,8 +35,10 @@ const Avatar = ({ url, size, onUpload }: AvatarProps): JSX.Element => {
}
const url = URL.createObjectURL(data);
setAvatarUrl(url);
} catch (error) {
console.log('Error downloading image: ');
} catch (error: unknown) {
if (error instanceof Error) {
console.log('Error downloading image: ', error.message);
}
}
}
@@ -67,8 +69,10 @@ const Avatar = ({ url, size, onUpload }: AvatarProps): JSX.Element => {
}
onUpload(filePath);
} catch (error) {
alert('There was an issue with the upload, please try again');
} catch (error: unknown) {
if (error instanceof Error) {
alert(error.message);
}
} finally {
setUploading(false);
}

View File

@@ -65,8 +65,10 @@ const Dashboard = ({ profile, session, plan }: DashboardProps): JSX.Element => {
if (error) {
throw error;
}
} catch (error) {
alert('There was an issue with the update');
} catch (error: unknown) {
if (error instanceof Error) {
alert(error.message);
}
} finally {
setLoading(false);
toast.success('Your profile has been updated');