Fix error fetching appointments with empty clinic list
This commit is contained in:
		@@ -1,7 +1,8 @@
 | 
				
			|||||||
export async function get_api_appointments({ fetch, clinics = [], date = 'T' } = {}) {
 | 
					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, '|');
 | 
						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, '|');
 | 
						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 } = {}) {
 | 
					export async function get_api_lookup({ fetch, query, ordinal, force = false } = {}) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user