Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Page not reloading on navigate("/") (svelte-routing)

$
0
0

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!


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>