aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
diff options
context:
space:
mode:
authorBrian Kim <brian@tagg.id>2021-05-12 17:42:47 -0700
committerBrian Kim <brian@tagg.id>2021-05-12 17:42:47 -0700
commit853bd0600e0da87af578c17ce9249e40888017b5 (patch)
treeee52f9d527536c41a040d06179be9f57f6663581 /src/utils/common.ts
parentd930b614bd79bcd7b55359be261f77fa6997f78e (diff)
Modularized as much as possible
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;
+ });
+};