Skip to content

Commit

Permalink
fix: avoid popup blocking when redirecting
Browse files Browse the repository at this point in the history
  • Loading branch information
pyphilia committed Jul 27, 2021
1 parent 82c7ad5 commit 554a91a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/navigation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// eslint-disable-next-line import/prefer-default-export
export const redirect = (url, { openInNewTab = false } = {}) => {
const options = openInNewTab ? '_blank' : null;
window.open(url, options);
if (openInNewTab) {
window.open(url, '_blank');
} else {
window.location.href = url;
}
};

0 comments on commit 554a91a

Please sign in to comment.