Fix error handling undefined configuration user/clinics
This commit is contained in:
parent
b6ba225e3d
commit
6da6b70537
@ -2,8 +2,12 @@
|
|||||||
export async function load({ params, fetch }) {
|
export async function load({ params, fetch }) {
|
||||||
let clinics = await (await fetch('/api/clinic/list')).json();
|
let clinics = await (await fetch('/api/clinic/list')).json();
|
||||||
clinics.reduce((acc, item) => (acc[item.name] = item, acc), clinics);
|
clinics.reduce((acc, item) => (acc[item.name] = item, acc), clinics);
|
||||||
let selection = await (await fetch('/api/config/user/clinics')).json();
|
try {
|
||||||
selection.forEach(x => clinics[x] ? clinics[x].active = true : false);
|
let selection = await (await fetch('/api/config/user/clinics')).json();
|
||||||
|
selection.forEach(x => clinics[x] ? clinics[x].active = true : false);
|
||||||
|
} catch(ex) {
|
||||||
|
console.error(ex, ex.stack);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
clinics
|
clinics
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user