diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2018-01-31 15:24:54 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2018-01-31 15:24:54 +0000 |
commit | 2f1a55fa4ef7bbb19ba1bc4de9543878682253d7 (patch) | |
tree | 7d6c67277157a33ffd42cead67293291fda5be3f /app/assets/javascripts/lib/utils/common_utils.js | |
parent | a0fc0fcc53edf316ca8190b93605d198e7de7a65 (diff) | |
download | gitlab-ce-2f1a55fa4ef7bbb19ba1bc4de9543878682253d7.tar.gz |
Use axios instead of jquery ajax for setCiStatusFavicon
Diffstat (limited to 'app/assets/javascripts/lib/utils/common_utils.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 03918762842..8018ec411c1 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -1,4 +1,5 @@ import { getLocationHash } from './url_utility'; +import axios from './axios_utils'; export const getPagePath = (index = 0) => $('body').attr('data-page').split(':')[index]; @@ -382,22 +383,16 @@ export const resetFavicon = () => { } }; -export const setCiStatusFavicon = (pageUrl) => { - $.ajax({ - url: pageUrl, - dataType: 'json', - success: (data) => { +export const setCiStatusFavicon = pageUrl => + axios.get(pageUrl) + .then(({ data }) => { if (data && data.favicon) { setFavicon(data.favicon); } else { resetFavicon(); } - }, - error: () => { - resetFavicon(); - }, - }); -}; + }) + .catch(resetFavicon); export const spriteIcon = (icon, className = '') => { const classAttribute = className.length > 0 ? `class="${className}"` : ''; |