Save value of the tracking setting on both 'next' and 'skip profiler actions (https://github.com/woocommerce/woocommerce-admin/pull/2468)
This commit is contained in:
parent
762a2d6540
commit
592c9d8e15
|
@ -69,12 +69,19 @@ class Start extends Component {
|
||||||
this.skipWizard = this.skipWizard.bind( this );
|
this.skipWizard = this.skipWizard.bind( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateTracking() {
|
||||||
|
const { updateSettings } = this.props;
|
||||||
|
const allowTracking = this.state.allowTracking ? 'yes' : 'no';
|
||||||
|
await updateSettings( { advanced: { woocommerce_allow_tracking: allowTracking } } );
|
||||||
|
}
|
||||||
|
|
||||||
async skipWizard() {
|
async skipWizard() {
|
||||||
const { addNotice, isProfileItemsError, updateProfileItems } = this.props;
|
const { addNotice, isProfileItemsError, updateProfileItems, isSettingsError } = this.props;
|
||||||
|
|
||||||
await updateProfileItems( { skipped: true } );
|
await updateProfileItems( { skipped: true } );
|
||||||
|
await this.updateTracking();
|
||||||
|
|
||||||
if ( isProfileItemsError ) {
|
if ( isProfileItemsError || isSettingsError ) {
|
||||||
addNotice( {
|
addNotice( {
|
||||||
status: 'error',
|
status: 'error',
|
||||||
message: __( 'There was a problem updating your preferences.', 'woocommerce-admin' ),
|
message: __( 'There was a problem updating your preferences.', 'woocommerce-admin' ),
|
||||||
|
@ -83,10 +90,9 @@ class Start extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
async startWizard() {
|
async startWizard() {
|
||||||
const { addNotice, isSettingsError, updateSettings } = this.props;
|
const { addNotice, isSettingsError } = this.props;
|
||||||
|
|
||||||
const allowTracking = this.state.allowTracking ? 'yes' : 'no';
|
await this.updateTracking();
|
||||||
await updateSettings( { advanced: { woocommerce_allow_tracking: allowTracking } } );
|
|
||||||
|
|
||||||
if ( ! isSettingsError ) {
|
if ( ! isSettingsError ) {
|
||||||
this.props.goToNextStep();
|
this.props.goToNextStep();
|
||||||
|
|
Loading…
Reference in New Issue