From 75620baeac2ece63fa4ae7589928adce287ebfd7 Mon Sep 17 00:00:00 2001 From: inportb Date: Wed, 10 Apr 2024 22:00:01 -0400 Subject: [PATCH] Fix error fetching appointments with empty clinic list --- frontend/src/lib/backend.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/backend.js b/frontend/src/lib/backend.js index 3e71356..e92ab14 100644 --- a/frontend/src/lib/backend.js +++ b/frontend/src/lib/backend.js @@ -1,7 +1,8 @@ export async function get_api_appointments({ fetch, clinics = [], date = 'T' } = {}) { if(clinics.constructor === Array) clinics = clinics.map(x => x.replace(/^\s+|\s+$/g, '').replace(/\s+/, ' ')).filter(x => x).join('^').replace(/\//g, '|'); else clinics = clinics.replace(/^\s+|\s+$/g, '').replace(/\s+/, ' ').replace(/\//g, '|'); - return await (await (fetch || window.fetch)('/api/appointments/' + clinics + '/' + date)).json(); + if(clinics) return await (await (fetch || window.fetch)('/api/appointments/' + clinics + '/' + date)).json(); + else return []; } export async function get_api_lookup({ fetch, query, ordinal, force = false } = {}) {