mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
fix: hides Search Console Stats if its not connected
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user