mirror of
https://github.com/usetrmnl/byos_node_lite.git
synced 2026-08-13 23:18:18 -07:00
20 lines
476 B
TypeScript
20 lines
476 B
TypeScript
import {TIMEZONE} from "Config.js";
|
|
import {getHackerNews, HackerNewsData} from "./HackerNewsData.js";
|
|
|
|
export type TemplateDataType = {
|
|
time: string
|
|
hackerNews: HackerNewsData,
|
|
}
|
|
|
|
export async function prepareData(): Promise<TemplateDataType> {
|
|
const time = new Date().toLocaleTimeString(undefined, {
|
|
timeZone: TIMEZONE,
|
|
hour: 'numeric',
|
|
});
|
|
const hackerNews = await getHackerNews();
|
|
return {
|
|
time,
|
|
hackerNews,
|
|
}
|
|
}
|