aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-05-18 13:00:14 -0400
committerGitHub <noreply@github.com>2021-05-18 13:00:14 -0400
commitc8487348e1026a3a2c1a147d3eefe3ee0cc6528c (patch)
tree72061e400748adce01ad90b2b5943e135fa25323 /src/utils/common.ts
parentefc84a7a5af59bcaf219d2ecb6767a3b29d01fae (diff)
parent4aca9fc0916240ce5e4284d625f240998db17bff (diff)
Merge pull request #429 from brian-tagg/tma844-bugfix-plus-sign
[TMA-844] Plus sign for profile and header in profile
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r--src/utils/common.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts
index ce4ab7d1..95e77f64 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -180,3 +180,20 @@ const _crestIcon = (university: UniversityType) => {
return require('../assets/images/bwbadges.png');
}
};
+
+export const validateImageLink = async (url: string | undefined) => {
+ if (!url) {
+ return false;
+ }
+ return fetch(url)
+ .then((res) => {
+ if (res.status === 200) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ .catch((_) => {
+ return false;
+ });
+};