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: Add clerk_organization & clerk_organization_id helpers #22

Merged
merged 1 commit into from
Nov 2, 2022
Merged

Conversation

agis
Copy link
Member

@agis agis commented Nov 2, 2022

This fetches the organization ID of the currently authenticated session, if any. Otherwise it returns nil.

Copy link
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

What about clerk_organization?

@agis
Copy link
Member Author

agis commented Nov 2, 2022

What about clerk_organization?

Thought about that, but it would be inconsistent with the other helpers. We currently have:

  • clerk_user which returns a User object
  • clerk_user_id which returns the User's ID

Following that same convention, it made sense for it to be suffixed with _id since it returns an ID.

Then, I chose org over organization for convenience/brevity. Do you think we should change it to clerk_organization_id?

@SokratisVidros
Copy link
Contributor

That's right. I am suggesting to have both, clerk_organization should return the full clerk_organization object.

@agis
Copy link
Member Author

agis commented Nov 2, 2022

Overhauled this to introduce two new helpers:

  • clerk_organization does a BAPI call to fetch the organization object, if any
  • clerk_organization_id returns the org ID (if any) by merely peeking at the session token

@SokratisVidros PTAL.

@agis agis changed the title feat: Add clerk_org_id helper method feat: Add clerk_organization & clerk_organization_id helpers Nov 2, 2022
Copy link
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

💯

@agis agis merged commit 800a78b into main Nov 2, 2022
@agis agis deleted the org-id branch November 2, 2022 13:27
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.

2 participants