Search bar redirect to local search results

This commit is contained in:
Paweł Malak
2021-10-27 11:52:57 +02:00
parent 3d3e2eed8c
commit da13ca6092
4 changed files with 66 additions and 25 deletions

View File

@@ -1,7 +1,11 @@
import { urlParser } from '.';
export const redirectUrl = (url: string, sameTab: boolean) => {
const parsedUrl = urlParser(url)[1];
if (sameTab) {
document.location.replace(url);
document.location.replace(parsedUrl);
} else {
window.open(url);
window.open(parsedUrl);
}
};