mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
feat(meds): scope the advanced-settings export to the single medication
The advanced sheet sits on one medication and its import already loads that medication's intake history, but the co-located export streamed every medication. Pass the medication id through to the export route, which narrows both the medication row and the intake history by it (always alongside userId, so a foreign id 404s rather than leaking).
This commit is contained in:
1 parent
8363db4146
commit
24ffca7220
4 files changed
+82
-5
No files matched your search
@@ -61,11 +61,14 @@ export function DataPortabilityRow({
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
const query = includeIntake ? "?intake=true" : "?intake=false";
|
||||
const query = new URLSearchParams({
|
||||
intake: includeIntake ? "true" : "false",
|
||||
medicationId,
|
||||
}).toString();
|
||||
const stamp = new Date().toISOString().slice(0, 10);
|
||||
await downloadFromUrl(
|
||||
`/api/export/medications${query}`,
|
||||
`healthlog-medications-${stamp}.csv`,
|
||||
`/api/export/medications?${query}`,
|
||||
`healthlog-medication-${stamp}.csv`,
|
||||
);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : String(err));
|
||||
|
||||
Reference in new issue
Block a user