diff --git a/src/app/manage/views/ManagePageContainer.tsx b/src/app/manage/views/ManagePageContainer.tsx index a30e267..023b3d5 100644 --- a/src/app/manage/views/ManagePageContainer.tsx +++ b/src/app/manage/views/ManagePageContainer.tsx @@ -27,15 +27,16 @@ export const ManagePageContainer = ({ const [allowedCustomField, setAllowedCustomField] = useState(null); - const customFieldsValue: any | null = client.customFields; + const [customFieldsValue, setCustomFieldsValue] = useState(client.customFields); const [profileData, setProfileData] = useState({}); const [originalProfileData, setOriginalProfileData] = useState({}); useMemo(() => { - if (customFieldAccess.length > 0) { - const allowedFields = customFieldAccess.filter((field: any) => field.permission?.length > 0); + if (_customFieldAccess.length > 0) { + const allowedFields = _customFieldAccess.filter((field: any) => field.permission?.length > 0); + console.log(allowedFields); const getSelectedValuesForMultiSelect = (key: string) => { const values = customFieldsValue[key]; if (!values) { @@ -95,6 +96,12 @@ export const ManagePageContainer = ({ const { data } = await res.json(); + const client = await fetch(`/api/client?clientId=${clientId}&token=${token}`); + + const updatedClientData = await client.json(); + + setCustomFieldsValue(updatedClientData.data.customFields); + setCustomFieldAccess(data); setLoading(false);