Skip to content

Commit

Permalink
Update comingSoon.isEnabled to return boolean value or null on error
Browse files Browse the repository at this point in the history
  • Loading branch information
wpalani committed Jan 5, 2024
1 parent 1716129 commit 0c7e907
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions static/js/coming-soon.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
};

const checkComingSoonStatus = async () => {
const result = {};
let status;

await window.wp
.apiFetch( {
Expand All @@ -23,17 +23,16 @@
} )
.then( ( response ) => {
if ( response.hasOwnProperty( 'comingSoon' ) ) {
result.success = true;
result.comingSoon = response.comingSoon;
status = response.comingSoon;
} else {
result.success = false;
status = null;
}
} )
.catch( () => {
result.success = false;
status = null;
} );

return result;
return status;
};

const enableComingSoon = async () => {
Expand Down

0 comments on commit 0c7e907

Please sign in to comment.