From 50ce985edcc92205f39f9fa126fb25fb746aaf23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20=C3=96brink?= Date: Wed, 10 Feb 2021 21:13:31 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20News=20item=20details=20n?= =?UTF-8?q?ow=20gets=20parsed=20(#55)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 News item details now gets parsed * fix: 🐛 Fake data for getNewsDetails() --- lib/api.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/api.ts b/lib/api.ts index 6df1ed64..afe17919 100644 --- a/lib/api.ts +++ b/lib/api.ts @@ -153,10 +153,13 @@ export class Api extends EventEmitter { } async getNewsDetails(child: Child, item: NewsItem): Promise { + 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 {