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

Hotfix/expired tokens #369

Merged
merged 10 commits into from
Oct 15, 2024
Merged

Hotfix/expired tokens #369

merged 10 commits into from
Oct 15, 2024

Conversation

MGS-sails
Copy link
Contributor

No description provided.

@MGS-sails MGS-sails self-assigned this Oct 1, 2024
@@ -244,6 +244,11 @@ async function fetchData(
rawResponse: response,
});
} catch (error) {
if (error.response.status === 401) {
Copy link
Member

Choose a reason for hiding this comment

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

Is the user then going to be presented with the login automatically again?

In that case, a message would be useful such as "Session expired, please login again".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @mberacochea .

I've added an alert to indicate this.

let me know your thoughts:

Uploading Screenshot 2024-10-04 at 15.58.46.png…

Copy link
Member

Choose a reason for hiding this comment

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

I can't see the screenshot, the upload doesn't seem to have worked

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-10-04 at 15 58 46

Hi @mberacochea let me know if you can see the screenshot now

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I can see the message now. IMO a VF info banner would be better, they are less obstructive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @mberacochea I've added the banner as suggested.
made a couple more changes to make the login form use a primary button and a loading spinner

Copy link
Member

@SandyRogers SandyRogers left a comment

Choose a reason for hiding this comment

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

Brilliant - thank you @MGS-sails ! One small query inline about possible race condition, otherwise happy to merge.

@@ -82,16 +85,21 @@ const Login: React.FC = () => {
setAuthToken(accessToken) as unknown as void;
setUsername('');
setPassword('');
if (localStorage.getItem('mgnify.sessionExpired')) {
localStorage.removeItem('mgnify.sessionExpired');
Copy link
Member

Choose a reason for hiding this comment

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

do we need to await this to avoid some race condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @SandyRogers actually I had meant to remove this part of the code, just pushed another commit to do that now.
I came to the conclusion that this part is not necessary. Trying to do this kind of opened a small can of worms.
The users can always just dismiss the banner. So I thought it may not be necessary to do this at this point in time

Copy link
Member

Choose a reason for hiding this comment

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

Ah, perfect. Thanks!

Copy link
Member

@mberacochea mberacochea left a comment

Choose a reason for hiding this comment

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

:shipit:

@MGS-sails MGS-sails merged commit 440a4ee into develop Oct 15, 2024
2 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.

3 participants