Skip to content

Commit

Permalink
Fixing server-side error handling on the JS side
Browse files Browse the repository at this point in the history
  • Loading branch information
aldavigdis committed Mar 6, 2024
1 parent 66f020d commit e4395a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class NineteenEightyWoo {
}

static async postSettingsData(formDataObject) {

const response = await fetch(
wpApiSettings.root + 'NineteenEightyWoo/v1/settings',
{
Expand All @@ -77,9 +78,11 @@ class NineteenEightyWoo {
}
);

if (response.ok) {
NineteenEightyWoo.settingsLoader().classList.add( 'hidden' );
NineteenEightyWoo.settingsSubmit().disabled = false;
NineteenEightyWoo.settingsLoader().classList.add( 'hidden' );
NineteenEightyWoo.settingsSubmit().disabled = false;

if ( ! response.ok ) {
NineteenEightyWoo.settingsErrorIndicator().classList.remove( 'hidden' );
}
}
}
Expand Down

0 comments on commit e4395a1

Please sign in to comment.