2017-03-30 17:31:59 +00:00
|
|
|
/**
|
|
|
|
* Helper function that finds the href of the fiven selector and updates the location.
|
|
|
|
*
|
|
|
|
* @param {String} selector
|
|
|
|
*/
|
2018-04-13 06:38:19 +00:00
|
|
|
export default selector => {
|
|
|
|
const element = document.querySelector(selector);
|
|
|
|
const link = element && element.getAttribute('href');
|
2017-03-30 17:31:59 +00:00
|
|
|
|
|
|
|
if (link) {
|
|
|
|
window.location = link;
|
|
|
|
}
|
|
|
|
};
|