feat: Improve menu (#109)
* Return empty array if no match on week Better to handle empty response in client * Parse all descriptions to markdown To get rid of <br/> and other stuff Co-authored-by: Johan Öbrink <johan.obrink@gmail.com>
This commit is contained in:
parent
0a02ffa04d
commit
9c4fcb2d25
|
@ -387,7 +387,7 @@ export class Api extends EventEmitter {
|
|||
}
|
||||
|
||||
public async getMenu(child: EtjanstChild): Promise<MenuItem[]> {
|
||||
if (this.isFake) return fakeResponse(fake.menu(child))
|
||||
if (this.isFake) return fakeResponse(fake.menu(child).map(parse.menuItem))
|
||||
|
||||
const menuService = await this.getMenuChoice(child)
|
||||
if (menuService === 'rss') {
|
||||
|
|
|
@ -18,34 +18,29 @@ export const menuList = (data: any): MenuItem[] => {
|
|||
)
|
||||
|
||||
if (!currentWeek) {
|
||||
return [
|
||||
{
|
||||
title: 'Måndag - Vecka ?',
|
||||
description: 'Hittade ingen meny',
|
||||
},
|
||||
]
|
||||
return []
|
||||
}
|
||||
|
||||
const menuItemsFS = [
|
||||
{
|
||||
title: `Måndag - Vecka ${currentWeek.week}`,
|
||||
description: currentWeek.mon,
|
||||
description: toMarkdown(currentWeek.mon) ,
|
||||
},
|
||||
{
|
||||
title: `Tisdag - Vecka ${currentWeek.week}`,
|
||||
description: currentWeek.tue,
|
||||
description: toMarkdown(currentWeek.tue),
|
||||
},
|
||||
{
|
||||
title: `Onsdag - Vecka ${currentWeek.week}`,
|
||||
description: currentWeek.wed,
|
||||
description: toMarkdown(currentWeek.wed),
|
||||
},
|
||||
{
|
||||
title: `Torsdag - Vecka ${currentWeek.week}`,
|
||||
description: currentWeek.thu,
|
||||
description: toMarkdown(currentWeek.thu),
|
||||
},
|
||||
{
|
||||
title: `Fredag - Vecka ${currentWeek.week}`,
|
||||
description: currentWeek.fri,
|
||||
description: toMarkdown(currentWeek.fri),
|
||||
},
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue