refactor: use request interceptors in client service #11656
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Removes the old way of re-initializing clients in the client service when they needed to. The client service now uses request interceptors for the dynamic headers such as
Authorization
.This a) is more developer friendly since the client service can now be destructured and b) removes the overhead of re-initializing the clients over and over again.
A few (non-breaking) changes needed to be done in the
web-client
package for this. It now exposes the 3 individual client init methods for initializing clients via theweb-client
package:graph()
ocs()
webdav()
This also deprecates the
client()
method which initializes all 3 clients at the same time because it's intransparent to the user. E.g. you pass anaxios
instance to this method, but the webdav client doesn't use it. So users might run into scenarios where they wonder why specific things don't work (e.g. request interceptors).Related Issue
Types of changes