gitlab-org--gitlab-foss/app/assets/javascripts/shortcuts_dashboard_navigation.js

16 lines
383 B
JavaScript
Raw Normal View History

import { visitUrl } from './lib/utils/url_utility';
2017-03-30 13:31:59 -04:00
/**
* Helper function that finds the href of the fiven selector and updates the location.
*
* @param {String} selector
*/
export default function findAndFollowLink(selector) {
const element = document.querySelector(selector);
const link = element && element.getAttribute('href');
2017-03-30 13:31:59 -04:00
if (link) {
visitUrl(link);
2017-03-30 13:31:59 -04:00
}
}