Skip to content

Commit

Permalink
Merge pull request #664 from credebl/hotfix/update-org
Browse files Browse the repository at this point in the history
hotfix: update organization payload
  • Loading branch information
GHkrishna authored Apr 19, 2024
2 parents 7030847 + 09cb609 commit 7a20f7a
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/components/organization/EditOrgdetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ import defaultUserIcon from '../../../public/images/person_FILL1_wght400_GRAD0_o
import { processImage } from '../../utils/processImage';
import FormikErrorMessage from '../../commonComponents/formikerror/index'

interface IUpdateOrgPayload {
orgId: string | undefined;
name: string;
description: string;
website: string;
isPublic: boolean | undefined;
logo?: string;
}

const EditOrgdetailsModal = (props: EditOrgdetailsModalProps) => {
const [logoImage, setLogoImage] = useState<ILogoImage>({
logoFile: '',
Expand Down Expand Up @@ -82,14 +91,20 @@ const EditOrgdetailsModal = (props: EditOrgdetailsModalProps) => {
const submitUpdateOrganization = async (values: Values) => {
setLoading(true);

const orgData = {
const orgData: IUpdateOrgPayload = {
orgId: props?.orgData?.id,
name: values.name,
description: values.description,
logo: (logoImage?.imagePreviewUrl as string) || props?.orgData?.logoUrl,
website: values.website,
isPublic: isPublic,
};

const logo = (logoImage?.imagePreviewUrl as string) || props?.orgData?.logoUrl

if ((logo?.includes('data:image/') && logo?.includes(';base64'))) {
orgData['logo'] = logo;
}

try {
const response = await updateOrganization(
orgData,
Expand Down

0 comments on commit 7a20f7a

Please sign in to comment.