Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: handlegetUser error#3285

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AbhineetJain merged 6 commits intomainfromabhineetjain/handle-get-user-error
Jul 29, 2022
Merged

Conversation

AbhineetJain
Copy link
Contributor

@AbhineetJainAbhineetJain commentedJul 29, 2022
edited
Loading

Building on#3241, this PR handles thegetUser error fromauthXService.

Special criteria: The error is only shown when redirecting to the/login page from a page other than/. It is also not shown when loading the/login page directly.

Subtasks

  • showgetUser error above the Sign-in form
  • restrict showing the error only when redirecting (except redirecting from/)
  • added stories
  • update relevant backend API middleware errors to have the aYou are signed out. orAn internal error occurred message and move the details in the error details section.

Fixes#3088

Screenshot

Screen Shot 2022-07-28 at 11 14 29 PM

@AbhineetJainAbhineetJain requested review froma teamJuly 29, 2022 02:55
@AbhineetJainAbhineetJain self-assigned thisJul 29, 2022
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

I'd like to see the 500 error changed, but other than that, backend looks good. 👍🏻

export const LoginPage: React.FC = () => {
const styles = useStyles()
const location = useLocation()
const xServices = useContext(XServiceContext)
const [authState, authSend] = useActor(xServices.authXService)
const isLoading = authState.hasTag("loading")
const redirectTo = retrieveRedirect(location.search)
const locationState = location.state ? (location.state as LocationState) : null
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 use a ternary because of types? Or can we:

Suggested change
constlocationState=location.state ?(location.stateasLocationState) :null
constlocationState=location.state??null

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

location.state can benull, but since we are typecasting it, the compiler thinks it is nevernull, so we are typecasting it only if it is not null.

Kira-Pilot reacted with thumbs up emoji
Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

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

FE looks great!

if (authState.matches("signedOut")) {
return <Navigate to={navigateTo} />
return <Navigate to={navigateTo}state={{ isRedirect: !isHomePage }}/>
Copy link
Contributor

Choose a reason for hiding this comment

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

doesisRedirect replicate the functionality ofembedRedirect?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think wecould use one both to know whether to show the error and where to go next, but it might be better to keep them separate like this

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, we’d probably have to retrieve the redirect in the component but that didn’t seem like a very solid approach.

@AbhineetJainAbhineetJain merged commite94fe20 intomainJul 29, 2022
@AbhineetJainAbhineetJain deleted the abhineetjain/handle-get-user-error branchJuly 29, 2022 17:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@deansheatherdeansheatherdeansheather left review comments

@mafredrimafredrimafredri approved these changes

@presleyppresleyppresleyp approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

@Kira-PilotKira-PilotKira-Pilot approved these changes

Assignees

@AbhineetJainAbhineetJain

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Fix error messages in authXService
6 participants
@AbhineetJain@mafredri@presleyp@johnstcn@deansheather@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp