File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,10 +142,10 @@ class Api {
142142
143143 /**
144144 * Get the HTTP client to use for requests
145- * @returns {Promise< FetchClient> } HTTP client
145+ * @returns {FetchClient } HTTP client
146146 * @throws {Error } If no client is available
147147 */
148- async getClient ( ) {
148+ getClient ( ) {
149149 if ( this . options . mock ) {
150150 console . warn ( '@beyonk/http: Using mocked http client' )
151151 return this . options . mock
@@ -154,7 +154,7 @@ class Api {
154154 if ( this . client ) {
155155 return this . client
156156 } else if ( config && config . fetch ) {
157- return await config . fetch ( )
157+ return config . fetch
158158 } else if ( typeof window !== 'undefined' ) {
159159 return window . fetch . bind ( window )
160160 }
@@ -210,7 +210,7 @@ class Api {
210210 this . config . overrides
211211 )
212212
213- const client = await this . getClient ( )
213+ const client = this . getClient ( )
214214 const ep = this . config . query ? `${ endpoint } ?${ this . config . query } ` : `${ endpoint } `
215215
216216 /** @type {QueryResult|undefined } */
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ export type ApiOptions = {
88 baseUrl ?: string ;
99 /** Mock client for testing */
1010 mock ?: FetchClient ;
11- /** Function that returns a fetch client */
12- fetch ?: ( ) => FetchClient | Promise < FetchClient > ;
11+ /** Fetch client for HTTP requests */
12+ fetch ?: FetchClient ;
1313 /** Whether to retry failed requests */
1414 retry ?: RetryOptions | false ;
1515 /** Whether to parse error responses as JSON */
You can’t perform that action at this time.
0 commit comments