Skip to content

Commit c93dbf8

Browse files
committed
createTestClient util
1 parent b0b6859 commit c93dbf8

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@profcomff/api-uilib",
3-
"version": "latest",
3+
"version": "2024.07.27",
44
"description": "API wrappers, autogenerated from openapi.json files",
55
"main": "./src/index.ts",
66
"types": "./src/index.d.ts",
@@ -10,8 +10,7 @@
1010
"publishConfig": {
1111
"exports": {
1212
".": "./src/index.js"
13-
},
14-
"types": "./src/index.d.ts"
13+
}
1514
},
1615
"scripts": {
1716
"setVersion": "node ./scripts/setversion.js",

src/index.d.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const authMiddleware: Middleware = {
3232
},
3333
};
3434

35-
export const createClient = (baseUrl: string) => {
35+
export const createClient = (baseUrl: string): ReturnType<typeof Client<paths>> => {
3636
if (currentClient) {
3737
throw new Error("Client already initialized");
3838
}
@@ -44,6 +44,10 @@ export const createClient = (baseUrl: string) => {
4444
return currentClient;
4545
}
4646

47+
export const createTestClient = (baseUrl: string): ReturnType<typeof Client<paths>> => {
48+
return Client<paths>({ baseUrl });
49+
}
50+
4751
export const setupAuth = (newToken: string | null) => {
4852
currentToken = newToken;
4953
if (currentClient !== undefined) {

0 commit comments

Comments
 (0)