fix: fix wizard reseting on refresh and remove redirect on location
This commit is contained in:
parent
10be5576df
commit
13497ad8d5
|
@ -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 {
|
||||
|
|
|
@ -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}/>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue