summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib/utils/favicon_ci.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/lib/utils/favicon_ci.js')
-rw-r--r--app/assets/javascripts/lib/utils/favicon_ci.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/favicon_ci.js b/app/assets/javascripts/lib/utils/favicon_ci.js
new file mode 100644
index 00000000000..613e2620e02
--- /dev/null
+++ b/app/assets/javascripts/lib/utils/favicon_ci.js
@@ -0,0 +1,16 @@
+import axios from './axios_utils';
+import { setFaviconOverlay, resetFavicon } from './favicon';
+
+export const setCiStatusFavicon = (pageUrl) =>
+ axios
+ .get(pageUrl)
+ .then(({ data }) => {
+ if (data && data.favicon) {
+ return setFaviconOverlay(data.favicon);
+ }
+ return resetFavicon();
+ })
+ .catch((error) => {
+ resetFavicon();
+ throw error;
+ });