1 | import fetch from "isomorphic-unfetch";
|
2 | import { hnApiBaseUrl } from "./hn-api-base-url";
|
3 | import { Updated } from "./updated";
|
4 |
|
5 | /**
|
6 | * `getLatestItemAndUserUpdates` returns the latest updates for items and users.
|
7 | *
|
8 | * @see {@link https://github.com/HackerNews/API#changed-items-and-profiles}
|
9 | */
|
10 | export async function getLatestItemAndUserUpdates(): Promise<Updated> {
|
11 | const endpoint = `${hnApiBaseUrl}/updates.json`;
|
12 | const res = await fetch(endpoint);
|
13 | const updates = await res.json();
|
14 | return updates;
|
15 | }
|