debian-mirror-gitlab/app/assets/javascripts/shortcuts_dashboard_navigation.js

16 lines
383 B
JavaScript
Raw Normal View History

2018-10-15 14:42:47 +05:30
import { visitUrl } from './lib/utils/url_utility';
2017-08-17 22:00:37 +05:30
/**
* Helper function that finds the href of the fiven selector and updates the location.
*
* @param {String} selector
*/
2018-10-15 14:42:47 +05:30
export default function findAndFollowLink(selector) {
const element = document.querySelector(selector);
const link = element && element.getAttribute('href');
2017-08-17 22:00:37 +05:30
if (link) {
2018-10-15 14:42:47 +05:30
visitUrl(link);
2017-08-17 22:00:37 +05:30
}
2018-10-15 14:42:47 +05:30
}