Skip to content

Commit

Permalink
fix: 🐛 News item details now gets parsed (kolplattformen#55)
Browse files Browse the repository at this point in the history
* fix: 🐛 News item details now gets parsed

* fix: 🐛 Fake data for getNewsDetails()
  • Loading branch information
JohanObrink authored Feb 10, 2021
1 parent d9d01de commit 50ce985
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,13 @@ export class Api extends EventEmitter {
}

async getNewsDetails(child: Child, item: NewsItem): Promise<any> {
if (this.isFake) {
return fake.news(child).find((ni) => ni.id === item.id)
}
const url = routes.newsDetails(child.id, item.id)
const response = await this.fetch(`news_${item.id}`, url, this.session)
const data = await response.json()
return data
return parse.newsItem(data)
}

async getMenu(child: Child): Promise<MenuItem[]> {
Expand Down

0 comments on commit 50ce985

Please sign in to comment.