I’m using following method for redirect in my authenticated component this.$f7.views.main.router.navigate('/');
And I’ve also tried this.$f7router.navigate('/')
method. But none of these method is working.
react : 16.13.0
framework7 : 5.7.10
framework7-react : 5.7.10
Authenticated component.
import React, { Component } from 'react';
import { Page, Row, Col } from 'framework7-react';
class Authenticated extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
return this.redirect();
}
componentDidUpdate() {
return this.redirect();
}
redirect = () => {
const { loggingIn, userId } = this.props.f7router.params;
console.log(loggingIn);
if(!loggingIn) {
console.log('redirect!');
this.$f7.views.main.router.navigate('/');
} else {
console.log('no redirect');
}
}
render() {
const { Component, ...rest } = this.props;
return (
<Page>
<Component { ...rest } />
</Page>
)
}
}
export default Authenticated;
When I change the route, in console I can see the outputs “redirect!”. But navigate function doesn’t have any effect!