I am working on a website and there for using Svelte and the svelte-routing library .The svelte-routing library has a method called navigate(path).I use this function on a click of a button and it works perfectly. But in my routeHandling.js file its not working as expected.I can see that it sets the url in the browser but its staying on the same page, so I have to press F5 (reload the page) to load the page.
import {navigate} from "svelte-routing";import * as axios from "axios";export function checkLoggedIn() { console.log("checkLoggedIn is now getting executed"); if (window.location.pathname !== "/" && window.location.pathname !== "/registration") { axios.default.get('http://127.0.0.1:5000/user', { headers: {'Authorization': `${localStorage.getItem("token")}` } }).catch(response => { navigate("/"); }); }}
Thanks in advance!