(id: string)
| 60 | } |
| 61 | |
| 62 | export async function getShare(id: string): Promise<HistoryItem> { |
| 63 | const r = await fetch(`${API_HOST}/share/${id}`) |
| 64 | if (r.status !== 200) { |
| 65 | const body = (await r.json()) as ErrorBody |
| 66 | throw new Error(body.error.message) |
| 67 | } |
| 68 | const body = (await r.json()) as HistoryItem |
| 69 | body.createdAt = new Date() |
| 70 | return body |
| 71 | } |
| 72 | |
| 73 | export async function saveSession(session: SessionData): Promise<void> { |
| 74 | try { |