File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -55,21 +55,21 @@ export class ApiClient {
5555 return this . accessToken ?. token . access_token as string | undefined ;
5656 } ;
5757
58- private authMiddleware = ( apiClient : ApiClient ) : Middleware => ( {
59- async onRequest ( { request, schemaPath } ) {
58+ private authMiddleware : Middleware = {
59+ onRequest : async ( { request, schemaPath } ) => {
6060 if ( schemaPath . startsWith ( "/api/private/unauth" ) || schemaPath . startsWith ( "/api/oauth" ) ) {
6161 return undefined ;
6262 }
6363
6464 try {
65- const accessToken = await apiClient . getAccessToken ( ) ;
65+ const accessToken = await this . getAccessToken ( ) ;
6666 request . headers . set ( "Authorization" , `Bearer ${ accessToken } ` ) ;
6767 return request ;
6868 } catch {
6969 // ignore not availble tokens, API will return 401
7070 }
7171 } ,
72- } ) ;
72+ } ;
7373
7474 private readonly errorMiddleware : Middleware = {
7575 async onResponse ( { response } ) {
@@ -108,7 +108,7 @@ export class ApiClient {
108108 tokenPath : "/api/oauth/token" ,
109109 } ,
110110 } ) ;
111- this . client . use ( this . authMiddleware ( this ) ) ;
111+ this . client . use ( this . authMiddleware ) ;
112112 }
113113 this . client . use ( this . errorMiddleware ) ;
114114 }
You can’t perform that action at this time.
0 commit comments