Skip to content

Commit

Permalink
Merge pull request #599 from newfold-labs/fix/coming-soon
Browse files Browse the repository at this point in the history
Launch Button | Calling comingSoonAdminbarToggle on update of comingsoon state
  • Loading branch information
wpalani authored Jun 26, 2024
2 parents b92a2f4 + ae1e2cb commit 3d9e9d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/pages/ecommerce/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AppStore from '../../data/store';
import { useContext } from '@wordpress/element';
import { hostgatorSettingsApiFetch } from '../../util/helpers';
import '@newfold-labs/wp-module-ecommerce/hostgator.css';
import { comingSoonAdminbarToggle } from '../../util/helpers';

const EcomerceStore = () => {
const { store, setStore } = useContext( AppStore );
Expand All @@ -30,8 +31,10 @@ const EcomerceStore = () => {
hostgatorSettingsApiFetch(
{ comingSoon: ! store.comingSoon },
console.error,
( response ) =>
setStore( { ...store, comingSoon: ! store.comingSoon } )
( response ) => {
setStore( { ...store, comingSoon: ! store.comingSoon } );
comingSoonAdminbarToggle( ! store.comingSoon );
}
),
};
return (
Expand Down
6 changes: 6 additions & 0 deletions src/app/pages/home/welcomeSection.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { useUpdateEffect } from 'react-use';
import { OnboardingScreen } from '@newfold-labs/wp-module-ecommerce';
import { useNotification } from 'App/components/notifications';
import AppStore from '../../data/store';
import { useContext } from '@wordpress/element';
import { hostgatorSettingsApiFetch } from '../../util/helpers';
import { comingSoonAdminbarToggle } from '../../util/helpers';

const WelcomeSection = () => {
const { store, setStore } = useContext( AppStore );
Expand All @@ -14,6 +16,10 @@ const WelcomeSection = () => {
() => setStore( { ...store, comingSoon: ! store.comingSoon } )
);

useUpdateEffect( () => {
comingSoonAdminbarToggle( store.comingSoon );
}, [ store.comingSoon ] );

return (
<OnboardingScreen
comingSoon={ store.comingSoon }
Expand Down

0 comments on commit 3d9e9d1

Please sign in to comment.