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

Refactored needsLoadOrRefresh method #208

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

darseen
Copy link
Contributor

@darseen darseen commented Jan 16, 2024

Refactor needsLoadOrRefresh() method

Changes Made

Refactored the needsLoadOrRefresh() method for improved readability. The logic remains the same, but the code structure has been enhanced.

Before

needsLoadOrRefresh() {
    if (!this.accessToken) { return true; }
    else if ((Date.now() + TOKEN_BUFFER) > this.expiresAt) { return true; }
    else { return false; }
}

After

needsLoadOrRefresh() {
    return !this.accessToken || (Date.now() + TOKEN_BUFFER) > this.expiresAt;
}

Testing

All tests have been executed, and the changes have passed successfully.

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@minjikarin
Copy link
Contributor

minjikarin commented Jan 23, 2024

Thank you @darseen :) confirmed that all test are passed.

@minjikarin minjikarin merged commit 0e3670d into amadeus4dev:master Jan 23, 2024
4 checks passed
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