From ae1e2cb573c858bc23efa3b2d4b4e5b0172284e9 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Wed, 26 Jun 2024 17:37:45 +0530 Subject: [PATCH] coming soon fixes --- src/app/pages/ecommerce/page.js | 7 +++++-- src/app/pages/home/welcomeSection.js | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/pages/ecommerce/page.js b/src/app/pages/ecommerce/page.js index 852d8a86..2e43250b 100644 --- a/src/app/pages/ecommerce/page.js +++ b/src/app/pages/ecommerce/page.js @@ -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 ); @@ -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 ( diff --git a/src/app/pages/home/welcomeSection.js b/src/app/pages/home/welcomeSection.js index 6274034d..3f7c7ad3 100644 --- a/src/app/pages/home/welcomeSection.js +++ b/src/app/pages/home/welcomeSection.js @@ -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 ); @@ -14,6 +16,10 @@ const WelcomeSection = () => { () => setStore( { ...store, comingSoon: ! store.comingSoon } ) ); + useUpdateEffect( () => { + comingSoonAdminbarToggle( store.comingSoon ); + }, [ store.comingSoon ] ); + return (