feat: 🎸 Added .author and .imageAltText on NewsItem (#42)
* feat: 🎸 Added .author and .imageAltText on NewsItem * feat: 🎸 getNewsDetail returns single news article
This commit is contained in:
parent
f076e11a35
commit
6e84a6391a
|
@ -152,6 +152,13 @@ export class Api extends EventEmitter {
|
||||||
return parse.news(data)
|
return parse.news(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getNewsDetails(child: Child, item: NewsItem): Promise<any> {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
async getMenu(child: Child): Promise<MenuItem[]> {
|
async getMenu(child: Child): Promise<MenuItem[]> {
|
||||||
if (this.isFake) return fake.menu(child)
|
if (this.isFake) return fake.menu(child)
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ export const news = (childId: string) => (
|
||||||
`https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsOverview?childId=${childId}`
|
`https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsOverview?childId=${childId}`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export const newsDetails = (childId: string, newsId: string) => (
|
||||||
|
`https://etjanst.stockholm.se/vardnadshavare/inloggad2/News/GetNewsArticle?newsItemId=${newsId}&childId=${childId}`
|
||||||
|
)
|
||||||
|
|
||||||
export const image = (url: string) => (
|
export const image = (url: string) => (
|
||||||
`https://etjanst.stockholm.se/vardnadshavare/inloggad2/NewsBanner?url=${url}`
|
`https://etjanst.stockholm.se/vardnadshavare/inloggad2/NewsBanner?url=${url}`
|
||||||
)
|
)
|
||||||
|
|
|
@ -103,7 +103,7 @@ export interface NewsItem {
|
||||||
modified?: string
|
modified?: string
|
||||||
imageUrl?: string
|
imageUrl?: string
|
||||||
fullImageUrl?: string
|
fullImageUrl?: string
|
||||||
imageAltText: string
|
imageAltText?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue