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(ui): only initialize the api-client once #35

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

HazimAr
Copy link
Member

@HazimAr HazimAr commented Dec 12, 2024

@jhosep-marin this will fix the multiple requests you were seeing on the api logs

@HazimAr HazimAr requested a review from bryson-g December 12, 2024 18:07
@HazimAr HazimAr force-pushed the singleton branch 2 times, most recently from 3b69047 to 9a79fa6 Compare December 12, 2024 18:07
accessToken: string;
} | null = null;

private constructor() {}

Choose a reason for hiding this comment

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

usage syntax could be neater by calling getInstance inside the constructor and returning the instance, so you can use the singleton with the new ExampleClass() syntax.

i suppose it is just preference though

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats a good point you brought up. Can you push those changes to the PR and ill merge.

Choose a reason for hiding this comment

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

@HazimAr Actually TypeScript class constructors can't return promises so nvm

@HazimAr HazimAr merged commit 929d367 into main Dec 13, 2024
1 check passed
@HazimAr HazimAr deleted the singleton branch December 13, 2024 01:44
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