Commit 311eec48 authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

Merge branch 'zhoufang/dev/482' into 'dev'

#482 Added validation for org website before linking it to org logo

See merge request !559
parents 49099c5d 0d4af79c
......@@ -166,13 +166,22 @@ export default function DashboardIntro() {
return <Typography variant="body1">{errMsgForGetRequest}</Typography>;
}
let isWebsiteValid = false;
try {
// This will fail if the URL is not valid
new URL(orgIntro.website);
isWebsiteValid = true;
} catch (error) {
console.log(error);
}
return (
// Org logo will not be clickable if the website URL doesn't exist
// Org logo will not be clickable if the website URL does NOT exist or is NOT valid
<Link
href={orgIntro.website}
target="_blank"
rel="noreferrer"
className={orgIntro.website ? '' : classes.urlNotClickable}
className={isWebsiteValid ? '' : classes.urlNotClickable}
>
{orgIntro.imageURL ? (
<CardMedia component="img" className={classes.companyLogo} image={orgIntro.imageURL} alt={orgIntro.name} />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment