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

✨ add a utility getAccessToken to customerClient #1607

Merged
merged 3 commits into from
Jan 5, 2024

Conversation

michenly
Copy link
Contributor

@michenly michenly commented Jan 3, 2024

WHY are these changes introduced?

Add an getAccessToken to the customer client utility & restore the same customerAccessToken session key as we have it now.

The idea is that user will never need to care about token expiry or where to get the token when using customer utility

WHAT is this pull request doing?

  • Add getAccessToken utility
  • refactor all the customer login related session key into one object

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

nonce: string;
refresh_token: string;
state: string;
customerAccount: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only session key we are using now

@michenly michenly marked this pull request as ready for review January 4, 2024 21:23
@michenly michenly requested a review from a team January 5, 2024 15:33
'customer_access_token',
'access_token',
);
expect(session.set).not.toHaveBeenNthCalledWith(1, 'customerAccount', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely simpler at least in the tests when it's all grouped together :)

session.unset('customer_access_token');
session.unset('state');
session.unset('nonce');
session.unset(CUSTOMER_ACCOUNT_SESSION_KEY);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is better too, if we add other properties to the session, at least we won't accidentally forget to clear them.

@michenly michenly merged commit f6e6d19 into main Jan 5, 2024
8 of 10 checks passed
@michenly michenly deleted the add-get-access-token branch January 5, 2024 22:20
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