diff --git a/.changeset/early-peas-complain.md b/.changeset/early-peas-complain.md new file mode 100644 index 00000000000..566a0b54bd4 --- /dev/null +++ b/.changeset/early-peas-complain.md @@ -0,0 +1,5 @@ +--- +"@wso2is/features": patch +--- + +Fix the email template preview issues diff --git a/features/admin.email-management.v1/components/email-template-preview.tsx b/features/admin.email-management.v1/components/email-template-preview.tsx index 9cf5459b624..460ad5ad4d6 100644 --- a/features/admin.email-management.v1/components/email-template-preview.tsx +++ b/features/admin.email-management.v1/components/email-template-preview.tsx @@ -27,12 +27,11 @@ import React, { useState } from "react"; import { useSelector } from "react-redux"; -import useGetBrandingPreference from "../../admin.branding.v1/api/use-get-branding-preference"; import { BrandingPreferencesConstants } from "../../admin.branding.v1/constants"; import useBrandingPreference from "../../admin.branding.v1/hooks/use-branding-preference"; import { BrandingPreferenceThemeInterface } from "../../admin.branding.v1/models"; import { BrandingPreferenceUtils } from "../../admin.branding.v1/utils"; -import { AppState, store } from "../../admin.core.v1"; +import { AppState } from "../../admin.core.v1"; import { EmailTemplate } from "../models"; import { EmailCustomizationUtils } from "../utils"; @@ -59,7 +58,7 @@ export const EmailTemplatePreview: FunctionComponent(BrandingPreferencesConstants.DEFAULT_PREFERENCE.theme); - const organizationName: string = store.getState().auth.tenantDomain; + const organizationName: string = useSelector((state: AppState) => state?.organization?.organization?.name); const theme: string = useSelector((state: AppState) => state.config.ui.theme?.name); - const { - data: brandingPreference, - isLoading: isBrandingPreferenceLoading - } = useGetBrandingPreference(organizationName); - const emailTemplateBody: string = useMemo(() => { if (emailTemplate?.body) { return EmailCustomizationUtils.getTemplateBody( @@ -91,7 +85,6 @@ export const EmailTemplatePreview: FunctionComponent