Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2

Phase 3: guide content, deep dives and analytics tables #4

Mergedfukomerged 17 commits intomain fromphase-3-guidemerged by fuko

Showing 35 changed files with 12 additions and 2 deletions (loading 31).

x
0 of 35 viewed, 35 left
2 additions and 0 deletionssrc/api/client.tsModified
View file
@@ -24,10 +24,12 @@
headers: body === undefined ? undefined : { "Content-Type": "application/json" },
body: body === undefined ? undefined : JSON.stringify(body),
});
+ // #region throw-on-error
if (!response.ok) {
const { error } = (await response.json()) as ApiErrorBody;
throw new ApiError(response.status, error.code, error.message);
+ // #endregion throw-on-error
return response.status === 204 ? (undefined as T) : ((await response.json()) as T);
​
8 additions and 0 deletionssrc/api/fake-api.test.tsModified
View file
@@ -49,6 +49,14 @@
expect((await fakeFetch("/api/folders", { method: "DELETE" })).status).toBe(405);
});
​
+ it("filters notes by folder", async () => {
+ const all = await api.get<{ folderId: string }[]>("/api/notes");
+ const work = await api.get<{ folderId: string }[]>("/api/notes?folderId=work");