Ved
Ved

Reputation: 12093

Page is not redirecting to updated URL

I need to redirect to new URL for my application. I have an event on which I am changing the URL. Here URL is updated but page is not redirected. It only redirects after refresh. Please help me to solve this. Thanks.

JS:

 _onNewFlowCreated(newFlow) {
        let url= '/#/flows/'+ newFlow.uid +'/edit';
        //window.history.pushState({}, '', url);
         window.location.href= url;
    }

I tried using react-router. But not found solution.

Upvotes: 1

Views: 132

Answers (2)

Sagar
Sagar

Reputation: 69

try this one

import { Router, Redirect, Route, Link, browserHistory, IndexRoute, useRouterHistory, RouterContext, hashHistory } from 'react-router';
import { createHashHistory } from 'history';

Upvotes: 1

Ayo K
Ayo K

Reputation: 1774

if you are using reactjs use

browserHistory.push('/#/flows/'+ newFlow.uid +'/edit');

to navigate to another url

Upvotes: 0

Related Questions