Ensure services is always an array

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface
2023-07-01 21:40:06 +01:00
parent cf87c1a2b6
commit ce3033c455
2 changed files with 25 additions and 18 deletions

View File

@@ -40,7 +40,8 @@ async function arrDepBoard(CRS){
crs: CRS.toUpperCase()
};
const api = new ldb(ldbKey,false);
return await api.call('GetArrDepBoardWithDetails', options, false, false);
let d = await api.call('GetArrDepBoardWithDetails', options, false, false);
return await util.cleanData(d);
} catch (err) {
log.out(`ldbService.arrDepBoard: Lookup Failed for: ${CRS}`, 'warn');
return {
@@ -62,10 +63,7 @@ async function arrDepBoardStaff(CRS) {
services: 'PBS'
};
const api = new ldb(ldbsvKey,true);
let data = await api.call(
'GetArrivalDepartureBoardByCRS',
options, false, false);
return await util.cleanData(data);
return await api.call('GetArrivalDepartureBoardByCRS',options,false,false);
} catch (err) {
log.out(`ldbService.arrDepBoardStaff: Lookup Failed for: ${CRS}`, 'warn');
log.out(`ldbService.arrDepBoardStaff: ${err}`);