Skip to content

Commit

Permalink
change notification archive to use path param
Browse files Browse the repository at this point in the history
  • Loading branch information
andnorda committed May 15, 2024
1 parent 0ff2a16 commit 63c148f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 2 additions & 4 deletions packages/client/src/views/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ class ArchivableNotificaton extends HTMLElement {
if (id) {
this.querySelector("button")?.addEventListener("click", () =>
fetch(
endpointUrlWithParams("/api/notifications/archive", { id }),
{
method: "POST",
},
endpointUrlWithParams(`/api/notifications/${id}/archive`),
{ method: "POST" },
).then(() => {
this.parentElement?.remove();
logAmplitudeEvent(...analyticsEvents.arkivertBeskjed);
Expand Down
7 changes: 2 additions & 5 deletions packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,8 @@ app.get("/api/ta", async (c) => {
throw result.error;
}
});
app.post("/api/notifications/archive", async (c) => {
const id = c.req.query("id");
if (!id) {
return c.json({ error: "Missing id" }).status(400);
}
app.post("/api/notifications/:id/archive", async (c) => {
const id = c.req.param("id");

const result = await archiveNotification({
cookie: c.req.header("cookie") ?? "",
Expand Down

0 comments on commit 63c148f

Please sign in to comment.