Skip to content

Commit 07ba6f5

Browse files
committed
fix test
1 parent 919a856 commit 07ba6f5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cli/src/hooks/use-user-details-query.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useQuery } from '@tanstack/react-query'
22

33
import { getAuthToken } from '../utils/auth'
4-
import { getApiClient } from '../utils/codebuff-api'
4+
import { getApiClient, setApiClientAuthToken } from '../utils/codebuff-api'
55
import { logger as defaultLogger } from '../utils/logger'
66

77
import type {
@@ -37,8 +37,13 @@ export async function fetchUserDetails<T extends UserField>({
3737
logger = defaultLogger,
3838
apiClient: providedApiClient,
3939
}: FetchUserDetailsParams<T>): Promise<UserDetails<T> | null> {
40-
const apiClient =
41-
providedApiClient ?? getApiClient()
40+
let apiClient: CodebuffApiClient
41+
if (providedApiClient) {
42+
apiClient = providedApiClient
43+
} else {
44+
setApiClientAuthToken(authToken)
45+
apiClient = getApiClient()
46+
}
4247

4348
const response = await apiClient.me(fields)
4449

0 commit comments

Comments
 (0)