diff --git a/src/component/OrganisationDetails/OrgCoverImageUpload.tsx b/src/component/OrganisationDetails/OrgCoverImageUpload.tsx index 31d52fc..b059e3a 100644 --- a/src/component/OrganisationDetails/OrgCoverImageUpload.tsx +++ b/src/component/OrganisationDetails/OrgCoverImageUpload.tsx @@ -30,9 +30,8 @@ type Props = { }; const OrgCoverImageUpload = (props: Props) => { - const { editMode, handleEdit } = props; - let coverImageBase64 = localStorage.getItem('cachedCoverImage') - + const { editMode, handleEdit, setCoverImageBase64, coverImageBase64 } = props; + let coverImage = coverImageBase64 ? coverImageBase64 : localStorage.getItem('cachedCoverImage') const myFile: { file: string; imagePreviewUrl: any } = { file: "", @@ -58,6 +57,7 @@ const OrgCoverImageUpload = (props: Props) => { .then((res) => { HttpService.getCoverImage().then((imageBase64) => { handleEdit(); + setCoverImageBase64(imageBase64); localStorage.setItem('cachedCoverImage', imageBase64) }); }) @@ -76,9 +76,9 @@ const OrgCoverImageUpload = (props: Props) => { duration={0} style={{ opacity: editMode ? 0.25 : 1, transitionDuration: "0ms" }} src={ - !coverImageBase64 + !coverImage ? defaultCoverImage - : coverImageBase64 + : coverImage } /> diff --git a/src/component/OrganisationDetails/OrgDetailsContainer.tsx b/src/component/OrganisationDetails/OrgDetailsContainer.tsx index 1e65b3a..a894e10 100644 --- a/src/component/OrganisationDetails/OrgDetailsContainer.tsx +++ b/src/component/OrganisationDetails/OrgDetailsContainer.tsx @@ -72,27 +72,22 @@ const OrganisationDetailsContainer = (props: Props) => { 'policyUrl': organisationDetails?.policyUrl, 'description': organisationDetails?.description }) - HttpService.getCoverImage().then((coverImage) => { - setCoverImageBase64(coverImage); - localStorage.setItem('cachedCoverImage', coverImage) - }); HttpService.getLogoImage().then((logoImage) => { setLogoImageBase64(logoImage); localStorage.setItem('cachedLogoImage', logoImage) }); }, [organisationDetails]) + const verifyConnectionObj = useAppSelector( + (state) => state?.gettingStart?.data + ); + + const isVerify = verifyConnectionObj?.verification?.presentationState == 'verified'; + const callRightSideDrawer = () => { - isEnableAddCredential && setOpenRightSideDrawer(!openRightSideDrawer) + isVerify && setOpenRightSideDrawer(!openRightSideDrawer) } -const verifyConnectionObj = useAppSelector( - (state) => state?.gettingStart?.data -); - -const isVerify = verifyConnectionObj?.verification?.presentationState == 'verified'; - - const handleChange = (e) => { const { name, value } = e.target; setFormValue({ diff --git a/src/container/GettingStarted/index.tsx b/src/container/GettingStarted/index.tsx index d567345..f2138e2 100644 --- a/src/container/GettingStarted/index.tsx +++ b/src/container/GettingStarted/index.tsx @@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next'; import { useAppDispatch, useAppSelector } from "../../customHooks"; import { gettingStartAction, listConnectionAction } from '../../redux/actionCreators/gettingStart'; import Loader from "../../component/Loader"; +import { HttpService } from '../../service/HttpService'; const Container = styled("div")(({ theme }) => ({ margin: "0px 15px 0px 15px", @@ -39,6 +40,7 @@ const Item = styled("div")(({ theme }) => ({ const GettingStarted = () => { const [editMode, setEditMode] = useState(false); + const [coverImageBase64, setCoverImageBase64] = useState(); const dispatch = useAppDispatch(); const { t } = useTranslation('translation'); const navigate = useNavigate(); @@ -56,6 +58,10 @@ const GettingStarted = () => { useEffect(() => { !gettingStartData && dispatch(gettingStartAction()); !listConnections && dispatch(listConnectionAction(10, 0, false)); + HttpService.getCoverImage().then((coverImage) => { + setCoverImageBase64(coverImage); + localStorage.setItem('cachedCoverImage', coverImage) + }); }, []); const handleEdit = () => { @@ -67,8 +73,8 @@ const GettingStarted = () => {