fix: on back redirect

This commit is contained in:
Lakhan Samani
2021-08-09 08:46:07 +05:30
parent 6a1b484557
commit 2ccf872291
3 changed files with 8 additions and 5 deletions

View File

@@ -9,8 +9,11 @@ export default function Root() {
const { token, loading, config } = useAuthorizer();
useEffect(() => {
if (token && config.redirectURL !== window.location.toString()) {
window.location.href = config.redirectURL;
if (token) {
const url = new URL(config.redirectURL);
if (url.origin !== window.location.origin) {
window.location.href = config.redirectURL;
}
}
return () => {};
}, [token]);