YakovL commented on issue #324:
URL: https://github.com/apache/couchdb-nano/issues/324#issuecomment-1413309904

   Right, I see. I'm thinking about a way to make sure we're authorized before 
each request
   
       private get authedClientPromise(): Promise<nanoClient.ServerScope> {
           return (async () => {
               // TODO: check if we are authed
               // TODO: if not, do this.client.auth(...)
               return this.client
           })()
       }
   
   Could you suggested a proper way to do the "is authed" check? I understand 
that we can send a request, check if we got 401 and try to reauth in that case, 
but doing this in each method is very WET (although better in terms of 
performance: the "is authed" check is an additional request).
   
   May be it's possible to check the cookie expiration without a request? I'm 
not finding a dedicated method for this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to