Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use request interceptors in client service #11656

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

JammingBen
Copy link
Contributor

@JammingBen JammingBen commented Sep 25, 2024

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 the web-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 an axios 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests
  • Documentation
  • Maintenance (e.g. dependency updates or tooling)

@JammingBen JammingBen self-assigned this Sep 25, 2024
Copy link

update-docs bot commented Sep 25, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@JammingBen JammingBen force-pushed the refactor/client-service-interceptors branch 3 times, most recently from d1db596 to 1c723c7 Compare September 25, 2024 15:36
Jannik Stehle added 2 commits September 26, 2024 08:00
Exposes the 3 individual client init methods for initializing clients via the `web-client` package:

* graph()
* ocs()
* webdav()

This also deprecates the `client()` method which intializes all 3 clients at the same time because it's intransparent to the user. E.g. you pass an axios 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).
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.
@JammingBen JammingBen force-pushed the refactor/client-service-interceptors branch from 1c723c7 to c2dbc8a Compare September 26, 2024 06:01
Copy link

@JammingBen JammingBen marked this pull request as ready for review September 26, 2024 06:28
Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 🤖

@kulmann kulmann merged commit cf88474 into master Sep 26, 2024
3 checks passed
@kulmann kulmann deleted the refactor/client-service-interceptors branch September 26, 2024 12:16
@JammingBen JammingBen mentioned this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Web] make clientService more developer friendly
2 participants