From 42e526d93d68eb03f1090b28503af7a0fe72f994 Mon Sep 17 00:00:00 2001 From: Chamath Samarawickrama Date: Thu, 18 Apr 2024 20:07:01 +0530 Subject: [PATCH] use hook for fetching branding preference --- .../ai-branding-preference-provider.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/features/admin.ai.v1/providers/ai-branding-preference-provider.tsx b/features/admin.ai.v1/providers/ai-branding-preference-provider.tsx index 3e5d2ce8f99..88f5eec0af6 100644 --- a/features/admin.ai.v1/providers/ai-branding-preference-provider.tsx +++ b/features/admin.ai.v1/providers/ai-branding-preference-provider.tsx @@ -16,7 +16,6 @@ * under the License. */ -import useBrandingPreference from "features/admin.branding.v1/hooks/use-branding-preference"; import { BrandingPreferenceInterface } from "features/admin.branding.v1/models"; import cloneDeep from "lodash-es/cloneDeep"; import isEmpty from "lodash-es/isEmpty"; @@ -30,6 +29,9 @@ import React, { useEffect, useState } from "react"; +import { useSelector } from "react-redux"; +import useGetBrandingPreferenceResolve from "../../admin.branding.v1/api/use-get-branding-preference-resolve"; +import { AppState } from "../../admin.core.v1/store"; import useGetAIBrandingGenerationResult from "../api/use-get-ai-branding-generation-result"; import AIFeatureContext from "../context/ai-branding-feature-context"; import { BrandingGenerationResultAPIResponseInterface } from "../models/branding-preferences"; @@ -48,13 +50,17 @@ const AIBrandingPreferenceProvider: FunctionComponent(null); const [ operationId, setOperationId ] = useState(); const [ brandingGenerationCompleted, setBrandingGenerationCompleted ] = useState(false); + const tenantDomain: string = useSelector((state: AppState) => state.auth.tenantDomain); + + const { + data: brandingPreference + } = useGetBrandingPreferenceResolve(tenantDomain); + /** * Removes empty keys from an object. * @@ -113,9 +119,9 @@ const AIBrandingPreferenceProvider: FunctionComponent