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

Mvj 453 hds login #521

Merged
merged 12 commits into from
Sep 24, 2024
Merged

Mvj 453 hds login #521

merged 12 commits into from
Sep 24, 2024

Conversation

henrinie-nc
Copy link
Contributor

@henrinie-nc henrinie-nc commented Sep 13, 2024

I would like feedback on:

  • are the auth states being handled correctly, is this missing some situations that might occur?
  • sanity check the tests, is it testing what it seems or not?

Also if you see something obvious that triggers rerenders that would be nice. Not really ideal that e.g. USER_FOUND actions trigger multiple times. Is there a better way to define the useEffect's (One cause is probably mapStatesToPros on App, could see if something can be fixed there.

Check the docs here: https://hds.hel.fi/components/login/

} = this.props;
const CallbackPage = (props: Props) => {
const onSuccess = (user: User) => {
const { history } = props;
history.push(getRedirectUrlFromSessionStorage() || getRouteById(Routes.LEASES));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check if the url startswith /callback and don't store that into session storage. Could happen if auth callback from oidc server fails.

const { getStoredApiTokens } = useApiTokens();

const setLoggedInIfApiTokenExists = useCallback(() => {
const [_error, apiToken] = getStoredApiTokens();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider logging possible error

Copy link
Contributor

Choose a reason for hiding this comment

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

Normally _error is null, so if we want to log possible errors from getStoreApiTokens, it could be logged inside an if (_error) {} block. Might help debugging, but not necessary.

src/app/App.tsx Outdated Show resolved Hide resolved
const { getStoredApiTokens } = useApiTokens();

const setLoggedInIfApiTokenExists = useCallback(() => {
const [_error, apiToken] = getStoredApiTokens();
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally _error is null, so if we want to log possible errors from getStoreApiTokens, it could be logged inside an if (_error) {} block. Might help debugging, but not necessary.

@henrinie-nc henrinie-nc merged commit d665904 into develop Sep 24, 2024
3 checks passed
@henrinie-nc henrinie-nc deleted the MVJ-453-hds-login branch September 24, 2024 11:56
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.

3 participants