diff --git a/pages/domain/console/[slug]/index.tsx b/pages/domain/console/[slug]/index.tsx index 42bc732..d40e2ae 100644 --- a/pages/domain/console/[slug]/index.tsx +++ b/pages/domain/console/[slug]/index.tsx @@ -25,7 +25,8 @@ const DiscoverPage: NextPage = () => { const [scDateFilter, setSCDateFilter] = useState('thirtyDays'); const { data: appSettings } = useFetchSettings(); const { data: domainsData } = useFetchDomains(router); - const { data: keywordsData, isLoading: keywordsLoading, isFetching } = useFetchSCKeywords(router, !!(domainsData?.domains?.length)); + const scConnected = !!(appSettings && appSettings?.settings?.search_console_integrated); + const { data: keywordsData, isLoading: keywordsLoading, isFetching } = useFetchSCKeywords(router, !!(domainsData?.domains?.length) && scConnected); const theDomains: DomainType[] = (domainsData && domainsData.domains) || []; const theKeywords: SearchAnalyticsItem[] = keywordsData?.data && keywordsData.data[scDateFilter] ? keywordsData.data[scDateFilter] : []; @@ -64,7 +65,7 @@ const DiscoverPage: NextPage = () => { isLoading={keywordsLoading || isFetching} domain={activDomain} keywords={theKeywords} - isConsoleIntegrated={!!(appSettings && appSettings?.settings?.search_console_integrated) } + isConsoleIntegrated={scConnected} /> diff --git a/pages/domain/insight/[slug]/index.tsx b/pages/domain/insight/[slug]/index.tsx index b85221d..567e222 100644 --- a/pages/domain/insight/[slug]/index.tsx +++ b/pages/domain/insight/[slug]/index.tsx @@ -25,7 +25,8 @@ const InsightPage: NextPage = () => { const [scDateFilter, setSCDateFilter] = useState('thirtyDays'); const { data: appSettings } = useFetchSettings(); const { data: domainsData } = useFetchDomains(router); - const { data: insightData } = useFetchSCInsight(router, !!(domainsData?.domains?.length)); + const scConnected = !!(appSettings && appSettings?.settings?.search_console_integrated); + const { data: insightData } = useFetchSCInsight(router, !!(domainsData?.domains?.length) && scConnected); const theDomains: DomainType[] = (domainsData && domainsData.domains) || []; const theInsight: InsightDataType = insightData && insightData.data ? insightData.data : {}; @@ -64,7 +65,7 @@ const InsightPage: NextPage = () => { isLoading={false} domain={activDomain} insight={theInsight} - isConsoleIntegrated={!!(appSettings && appSettings?.settings?.search_console_integrated) } + isConsoleIntegrated={scConnected} />