Skip to content

Commit ce9f784

Browse files
committed
fix(cli): fix api client generation
1 parent 14ae185 commit ce9f784

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.changeset/late-drinks-happen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ddadaal/next-typed-api-routes-cli": patch
3+
---
4+
5+
fix api client generation

example/src/apis/api.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
import { fromApi } from "@ddadaal/next-typed-api-routes-runtime/lib/client";
44
import { join } from "path";
5-
6-
75
import type { LoginSchema } from "src/pages/api/login/[username]";
86
import type { RegisterSchema } from "src/pages/api/register/index";
97

8+
109
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
1110

1211

1312
export const api = {
1413
login: fromApi<LoginSchema>("GET", join(basePath, "/api/login/[username]")),
1514
register: fromApi<RegisterSchema>("POST", join(basePath, "/api/register")),
1615
};
17-

packages/cli/src/generateClients.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ import { join } from "path";
158158
fetchApiImportDeclaration +
159159
EOL + EOL +
160160
importDeclarations +
161-
EOL + EOL
161+
EOL + EOL +
162162
extraImports.join(EOL) +
163163
EOL + EOL +
164164
basePathVarDeclaration +

0 commit comments

Comments
 (0)