|
|
@ -123,18 +123,34 @@ export function useMarriageProfileQuery<TData = MarriageProfileResponse>( |
|
|
(old: MarriageProfileResponse | undefined) => { |
|
|
(old: MarriageProfileResponse | undefined) => { |
|
|
if (!old) return data; |
|
|
if (!old) return data; |
|
|
return { |
|
|
return { |
|
|
...old, |
|
|
|
|
|
...data, |
|
|
...data, |
|
|
match_summary: data.match_summary ?? old.match_summary, |
|
|
|
|
|
active_case: data.active_case ?? old.active_case, |
|
|
|
|
|
|
|
|
...old, |
|
|
|
|
|
match_summary: old.match_summary ?? data.match_summary, |
|
|
|
|
|
active_case: old.active_case ?? data.active_case, |
|
|
active_subscription: |
|
|
active_subscription: |
|
|
data.active_subscription ?? old.active_subscription, |
|
|
|
|
|
|
|
|
old.active_subscription ?? data.active_subscription, |
|
|
|
|
|
recommended_plan: |
|
|
|
|
|
old.recommended_plan ?? data.recommended_plan, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (data.id && (data.match_summary || data.status)) { |
|
|
if (data.id && (data.match_summary || data.status)) { |
|
|
saveScopedMarriageProfile(data); |
|
|
|
|
|
|
|
|
const currentPersisted = getScopedMarriageProfile(); |
|
|
|
|
|
const merged = { |
|
|
|
|
|
...data, |
|
|
|
|
|
...(currentPersisted || {}), |
|
|
|
|
|
match_summary: |
|
|
|
|
|
currentPersisted?.match_summary ?? data.match_summary, |
|
|
|
|
|
active_case: |
|
|
|
|
|
currentPersisted?.active_case ?? data.active_case, |
|
|
|
|
|
recommended_plan: |
|
|
|
|
|
currentPersisted?.recommended_plan ?? data.recommended_plan, |
|
|
|
|
|
active_subscription: |
|
|
|
|
|
currentPersisted?.active_subscription ?? |
|
|
|
|
|
data.active_subscription, |
|
|
|
|
|
}; |
|
|
|
|
|
saveScopedMarriageProfile(merged); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|