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(core): allow passing optional check params to Authenticated … #6483

Merged
merged 6 commits into from
Dec 3, 2024

Conversation

reedwane
Copy link
Contributor

…component

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

The Authenticated component doesn't take extra params for the useIsAuthenticated hook to check the auth status

What is the new behavior?

The component now has params in the props which is then passed to the authenticated hook call, which already allows for params: any
fixes (#6309)

Notes for reviewers

@reedwane reedwane requested a review from a team as a code owner November 11, 2024 10:15
Copy link

changeset-bot bot commented Nov 11, 2024

🦋 Changeset detected

Latest commit: b16c179

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@BatuhanW BatuhanW left a comment

Choose a reason for hiding this comment

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

Hey @reedwane thanks for the quick and neat PR! LGTM 👍🏼 We'll release it in December '24 release. ❤️

Comment on lines +623 to +628
check: async ({ params }) => {
// Simulate failed authentication based on params
return params?.allowAuth
? { authenticated: true }
: { authenticated: false, redirectTo: "/login" };
},
Copy link
Member

Choose a reason for hiding this comment

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

Optionally, this can be simplified. Passing a mockCheck here and assert that mockCheck is called with given mockParams. But this also works because you are checking if redirect is called, so it's a matter of taste.

@BatuhanW
Copy link
Member

Oh, a minor thing I forgot, we could also update Authenticated component documentation and mention that params can be passed to AuthProvider's check method.

@BatuhanW BatuhanW self-requested a review November 11, 2024 10:47
@reedwane
Copy link
Contributor Author

Oh. Okay @BatuhanW. sadly I have to run now...

I'm not sure why the linting is throwing an error... I installed the biome extension, but can't get it to format the file for some reason.... is this something someone else can easily help with?

@BatuhanW BatuhanW self-assigned this Nov 19, 2024
@reedwane
Copy link
Contributor Author

Thanks @BatuhanW. Apologies I couldn't continue since too. Have my hands quite tied presently

@BatuhanW
Copy link
Member

@reedwane no worries, we'll release it around December 5th. If we can't hear back from you until then, we can update documentation.

@alicanerdurmaz alicanerdurmaz changed the base branch from master to releases/december-2024 November 25, 2024 07:55
@BatuhanW
Copy link
Member

BatuhanW commented Dec 3, 2024

Hello @reedwane I have commits to complete your PR but I can't push to your fork. It seems contributor commits aren't allowed.

edit: it seems it was an issue with github cli, not your actually. Now it's pushed.

@BatuhanW BatuhanW merged commit 8309c56 into refinedev:releases/december-2024 Dec 3, 2024
14 checks passed
@BatuhanW BatuhanW mentioned this pull request Dec 3, 2024
@reedwane
Copy link
Contributor Author

reedwane commented Dec 4, 2024

Thanks @BatuhanW

The last couple of weeks have been quite the days. I'm just even seeing these notifications now. Thanks for completing the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants