We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62dfc5d commit b18a939Copy full SHA for b18a939
typing-app/docs/api-usage.md
@@ -6,8 +6,22 @@
6
7
例えば、
8
9
-```ts
10
-// WIP
+```tsx
+import { client } from "@/libs/api";
11
+
12
+async function SomePageToGetRanking() {
13
+ const { data, error } = await client.GET("/scores/ranking");
14
15
+ if (error) {
16
+ return <div>Error</div>;
17
+ }
18
19
+ return (
20
+ <div>
21
+ ranking data: {JSON.stringify(data)}
22
+ </div>
23
+ );
24
+}
25
```
26
27
のようにします。
typing-app/src/libs/api/index.ts
@@ -0,0 +1,4 @@
1
+import createClient from "openapi-fetch";
2
+import { paths } from "./v1";
3
4
+export const client = createClient<paths>({ baseUrl: process.env.API_URL });
0 commit comments