Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Function Redirect to another page

$
0
0

Hello, i need to redirect if the user onclick, the function verify if is good and redirect

const auth = async () => {
        let token = false
        await isToken()
            .then(response => {
                token = response
            })
        if (token) {
            return (
                <IonRouterOutlet>
                    <Route path="/events" component={Events} exact={true}/>
                    <Route path="/" render={() => <Redirect to="/events"/>} exact={true}/>
                </IonRouterOutlet>
            )
        }
    }

return (<IonButton onClick={(e) => auth()}>teste redirect</IonButton>)

but my code not redirect

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



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