Add web push notifications for new inbox items

This commit is contained in:
Ian Gulliver
2026-10-14 21:25:01 -07:00
parent 01c60d6618
commit 8e4c40eb5f
40 changed files with 1724 additions and 202 deletions
+4
View File
@@ -33,6 +33,9 @@ export async function request(method, path, opts = {}) {
init.body = JSON.stringify(opts.body);
}
const res = await fetch(url, init);
if (res.status === 204) {
return undefined;
}
const data = await res.json();
if (!res.ok) {
throw new ApiError(res.status, data.message);
@@ -42,6 +45,7 @@ export async function request(method, path, opts = {}) {
export const get = (path, opts) => request("get", path, opts);
export const post = (path, opts) => request("post", path, opts);
export const put = (path, opts) => request("put", path, opts);
export const del = (path, opts) => request("delete", path, opts);
export function subscribe(after, onEvent, onState) {
const source = new EventSource(`/api/events?after=${after}`);
source.onopen = () => onState(true);