summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/shortcuts_dashboard_navigation.js
blob: 9f69f110d06877172208b2bd1565d67114292dd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
  }
}