gitlab-org--gitlab-foss/app/assets/javascripts/shortcuts_dashboard_navigation.js
2018-04-13 10:45:26 -05:00

15 lines
383 B
JavaScript

import { visitUrl } from './lib/utils/url_utility';
/**
* 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');
if (link) {
visitUrl(link);
}
}