debian-mirror-gitlab/app/assets/javascripts/lib/utils/navigation_utility.js
2018-12-05 23:21:45 +05:30

15 lines
373 B
JavaScript

import { visitUrl } from './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);
}
}