debian-mirror-gitlab/app/assets/javascripts/shortcuts_dashboard_navigation.js
2018-10-15 14:42:47 +05:30

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);
}
}