debian-mirror-gitlab/app/assets/javascripts/lib/utils/icon_utils.js
2019-03-02 22:35:43 +05:30

18 lines
465 B
JavaScript

/* eslint-disable import/prefer-default-export */
import axios from '~/lib/utils/axios_utils';
/**
* Retrieve SVG icon path content from gitlab/svg sprite icons
* @param {String} name
*/
export const getSvgIconPathContent = name =>
axios
.get(gon.sprite_icons)
.then(({ data: svgs }) =>
new DOMParser()
.parseFromString(svgs, 'text/xml')
.querySelector(`#${name} path`)
.getAttribute('d'),
)
.catch(() => null);