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

feat: Expose axios interceptors #881

Merged
merged 1 commit into from
Nov 26, 2024
Merged

Conversation

artonge
Copy link
Collaborator

@artonge artonge commented Nov 5, 2024

This eases requesting for password confirmation

@artonge artonge self-assigned this Nov 5, 2024
@artonge artonge added enhancement New feature or request 3. to review Waiting for reviews javascript Pull requests that update Javascript code labels Nov 5, 2024
@artonge artonge force-pushed the artonge/feat/allow_to_get_password branch from 5db7eb6 to 5a3ca1a Compare November 5, 2024 17:00
@artonge artonge requested a review from susnux November 5, 2024 17:00
Copy link
Collaborator

@susnux susnux left a comment

Choose a reason for hiding this comment

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

Question would be:
Do we want to support both ways at the same time or only the new way in the future?

Because if we only use the new way in the future, then I think it would make more sense to provide a more convenient way to handle this.
Something like:

import axios from '@nextcloud/axios'
import { withPasswordConfirmation } from '@nextcloud/password-confirmation'

withPasswordConfirmation(axios).post('a/dangerous/route')

Where withPasswordConfirmation would add a once-time interceptor to the request that adds the password header.

What do you think?

@artonge
Copy link
Collaborator Author

artonge commented Nov 6, 2024

What do you think?

I was looking for something like that indeed !

src/main.ts Outdated Show resolved Hide resolved
src/globals.ts Outdated Show resolved Hide resolved
@artonge artonge force-pushed the artonge/feat/allow_to_get_password branch 4 times, most recently from 338fe4b to b608c82 Compare November 14, 2024 11:10
@artonge artonge changed the title feat: Expose promptForPassword function feat: Expose axios interceptors Nov 14, 2024
@artonge artonge requested a review from susnux November 14, 2024 11:16
src/globals.ts Outdated Show resolved Hide resolved
@artonge artonge force-pushed the artonge/feat/allow_to_get_password branch from 4aa17c7 to cdfe8ca Compare November 26, 2024 15:45
Signed-off-by: Louis Chemineau <louis@chmn.me>
@artonge artonge force-pushed the artonge/feat/allow_to_get_password branch from cdfe8ca to 259dc89 Compare November 26, 2024 16:03
@artonge artonge merged commit a4bf90c into main Nov 26, 2024
11 checks passed
@artonge artonge deleted the artonge/feat/allow_to_get_password branch November 26, 2024 16:05
@artonge artonge mentioned this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants