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); const url = URL.createObjectURL(data);
setAvatarUrl(url); setAvatarUrl(url);
} catch (error) { } catch (error: unknown) {
console.log('Error downloading image: '); 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); onUpload(filePath);
} catch (error) { } catch (error: unknown) {
alert('There was an issue with the upload, please try again'); if (error instanceof Error) {
alert(error.message);
}
} finally { } finally {
setUploading(false); setUploading(false);
} }

View File

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