fix(dashboard): map insurance and medical history correctly in account tab

The account tab read basic_insurance.id (object) but the profile returns
basic_insurance_id (number), yielding [NaN], and never loaded the medical
history (other). Map basic_insurance_id/supplementary_insurance_id and
merge profile.other on load, and keep the profile uuid even for an empty
profile so PATCH saves work. Verified round-trip (name→label, insurance,
other) against the live API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 19:36:34 +03:30
co-authored by Claude Opus 4.8
parent 0a95e99efa
commit 224c51069c
2 changed files with 150 additions and 1 deletions
@@ -35,12 +35,22 @@ function Information({ information, setInformation }) {
if (hasProfileData) {
let changedData = { ...profile };
changedData.basic_insurance = [Number(profile?.basic_insurance?.id)];
changedData.basic_insurance = profile?.basic_insurance_id ? [profile.basic_insurance_id] : [];
changedData.supplementary_insurance = profile?.supplementary_insurance_id ? [profile.supplementary_insurance_id] : [];
changedData.other = profile?.other ?? {
disease,
allergies: [],
medications: [],
surgeries: [],
family_history: [],
relatives: [],
};
changedData.prev_data = true;
changedData = changeDateType(changedData, false);
setInformation(changedData);
} else {
setInformation({
uuid: profile?.uuid,
prev_data: false,
other: {
disease: disease,