Not working Route in history?

Hello, I faced with 1 problem, the component login lilke makes a post request, then I make redirect to page with url /, ( I show and hide loader ), then I do not work route, that is, the url changes in the components why not rendereda

component code login
const App__singIn = props => {
 const [ name, setName ] = useState( " )
 const [ pass, setPass ] = useState( " )
 const [ error, setError ] = useState( false )
 const [ checked setChecked ] = useState( false )

 const click = () => {
 props.etLoader( true )

 const URLs = process.env.REACT_APP_API_AUTH
 const data = {
 email: name
 password: pass
}

 axios.post( url, data ).then( data =>
 data.status >= 199 && data.status <= 301 ?
(
 props.setLoader( false ),

 checked ? (
 setCookie( 'token', data.data.token, { expires: 365 } ),
 setCookie( 'id', data.data.id, { expires: 365 } ),
 setCookie( 'username', data.data.username, { expires: 365 } )
 ) : (
 setCookie( 'token', data.data.token ),
 setCookie( 'id', data.data.id)
 setCookie( 'username', data.data.username )
),

 props.setUser( true)

 props.browserHistory.push( '/' )
 ) : (
 props.setLoader( false) setError( true )
)
)

}

 if ( props.loader === true ) {
 return <p> Loader </p>
 } else {
 return (
 the <div >
 <div className={ s.fields }>
 <App__input type='text' value={ name } set={ setName } text='Mail'/>

 <App__input type='password' value={ pass } set={ setPass } text='Password'/>
</div>

 <div className={ s.checked } >
 <App__checkbox checked={ checked } setChecked={ setChecked } text='Remember me' />
</div>

 <App__btn click={ click } disable={ !name || !pass ? true : false } text='Log in'/>

 <div className={ s.changePass } >
 Forgot password
</div>
</div>
)
}

}

export default App__singIn


if you do not do dom manipulation then it works fine, but manipulation with the dom I need to show user icon
April 19th 20 at 12:18
0 answer

Find more questions by tags React