Skip to content

Commit

Permalink
Rebase, test get fetch args
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Apr 18, 2024
1 parent 2c309be commit 1fe7a96
Show file tree
Hide file tree
Showing 5 changed files with 2,801 additions and 2,789 deletions.
18 changes: 18 additions & 0 deletions client/src/api/schema/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import createClient from "openapi-fetch";

import { getAppRoot } from "@/onload/loadConfig";

import { paths } from "./schema"; // generated from openapi-typescript

export const { get, put } = createClient<paths>({ baseUrl: getAppRoot(undefined, true) });

// // Type-checked request
// await put("/blogposts", {
// body: {
// title: "My New Post",
// // ❌ Property 'publish_date' is missing in type …
// },
// });

// // Type-checked response
// const { data, error } = await get("/blogposts/{post_id}", { params: { path: { post_id: "123" } } });
1 change: 1 addition & 0 deletions client/src/api/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { get, put } from "./client";
export { type ApiResponse, fetcher } from "./fetcher";
export type { components, operations, paths } from "./schema";
Loading

0 comments on commit 1fe7a96

Please sign in to comment.