useLocationNavigation

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2022-07-30 10:00:34 +02:00
parent 005762a1a2
commit 3b74920ece
No known key found for this signature in database
GPG key ID: D1D45825D60C24D2

View file

@ -1,7 +1,7 @@
import { useEffect } from "react";
import { useHistory } from "react-router-dom";
export function useLocationNavigation(enabled = false) {
export function useLocationNavigation(enabled = false): void {
const history = useHistory();
useEffect(() => {
@ -12,7 +12,7 @@ export function useLocationNavigation(enabled = false) {
const url = new URL(tx.pathname, window.location.href);
url.search = tx.search;
url.hash = tx.hash;
window.location = url.href;
window.location.href = url.href;
});
}