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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user