Skip to content

Commit 905ea11

Browse files
committed
feat(jike-client): fromJSON add extra options
1 parent 14dae11 commit 905ea11

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/client/client.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,14 @@ export class JikeClient extends EventEmitter<EventMap> {
340340
/**
341341
* 从 JSON 数据创建
342342
* @param data 数据
343+
* @param config 其他配置项
343344
*/
344-
static fromJSON(data: JikeClientJSON): JikeClient {
345-
return new JikeClient(
346-
objectPick(data, [
345+
static fromJSON(
346+
data: JikeClientJSON,
347+
config: Partial<ApiConfig> = {}
348+
): JikeClient {
349+
return new JikeClient({
350+
...objectPick(data, [
347351
'endpointId',
348352
'endpointUrl',
349353
'bundleId',
@@ -355,8 +359,9 @@ export class JikeClient extends EventEmitter<EventMap> {
355359

356360
'accessToken',
357361
'refreshToken',
358-
])
359-
)
362+
]),
363+
...config,
364+
})
360365
}
361366

362367
/**

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export type { BeforeRequestHook } from 'ky'
2+
13
export {
24
request,
35
getAccessToken,

0 commit comments

Comments
 (0)