fix: fix wizard reseting on refresh and remove redirect on location

This commit is contained in:
Jonathan Rainville 2019-07-16 15:23:04 -04:00
parent 10be5576df
commit 13497ad8d5
No known key found for this signature in database
GPG Key ID: 5F4630B759727D9C
3 changed files with 4 additions and 18 deletions

View File

@ -47,7 +47,7 @@ function reducer(state = DEFAULT_STATE, action) {
};
case CHECK_LICENSE_OWNER:
return {
...state, licenseOwner: false
...state
};
case CHECK_LICENSE_OWNER_SUCCEEDED:
return {

View File

@ -5,7 +5,6 @@ import {connect} from "react-redux";
import DOMPurify from 'dompurify';
import SellerPosition from './components/SellerPosition';
import Loading from '../../../components/Loading';
import newSeller from "../../../features/newSeller";
import metadata from "../../../features/metadata";
@ -13,8 +12,7 @@ class Location extends Component {
constructor(props) {
super(props);
this.state = {
location: props.seller.location,
ready: false
location: props.seller.location
};
this.validate(props.seller.location);
this.props.footer.onPageChange(() => {
@ -22,15 +20,6 @@ class Location extends Component {
});
}
componentDidMount() {
if (this.props.profile && this.props.profile.location) {
this.props.setLocation(DOMPurify.sanitize(this.props.profile.location));
this.props.wizard.next();
} else {
this.setState({ready: true});
}
}
validate(location) {
if (location) {
this.props.footer.enableNext();
@ -45,10 +34,6 @@ class Location extends Component {
};
render() {
if (!this.state.ready) {
return <Loading page/>;
}
return <SellerPosition changeLocation={this.changeLocation} location={this.state.location}/>;
}
}

View File

@ -7,7 +7,8 @@ import withFooterHoC from './hoc/withFooter';
class Wizard extends Component {
constructor(props) {
super(props);
let currentStep = props.steps.findIndex((step) => props.location.hash.endsWith(step.path));
const locationHash = props.location.hash || props.location.pathname;
let currentStep = props.steps.findIndex((step) => locationHash.endsWith(step.path));
if (currentStep === -1) {
currentStep = 0;