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

ui: redirect to login page when api call is unauthorized #26053

Merged
merged 2 commits into from
May 29, 2018

Conversation

couchand
Copy link
Contributor

ui: pass both api handlers in a single then call

Previously the API handlers in CachedDataReducer were attached with
a then followed by a catch, which meant errors in the dispatch of
success would show up as API errors erroneously. This change moves
both handlers into a single invocation of then to fix the issue.

Release note: None

ui: redirect to login page when api call is unauthorized

When we get a 401 HTTP status code, redirect to the login
page. Once logout is implemented, this should do that
instead, to make sure client-side state is clean.

Fixes: #25785
Release note: None

Previously the API handlers in CachedDataReducer were attached with
a then followed by a catch, which meant errors in the dispatch of
success would show up as API errors erroneously.  This change moves
both handlers into a single invocation of then to fix the issue.

Release note: None
When we get a 401 HTTP status code, redirect to the login
page.  Once logout is implemented, this should do that
instead, to make sure client-side state is clean.

Fixes: cockroachdb#25785
Release note: None
@couchand couchand requested a review from a team May 24, 2018 19:42
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@vilterp
Copy link
Contributor

vilterp commented May 24, 2018

Thx for taking care of the promise error handlers. Will review soon!

@vilterp vilterp mentioned this pull request May 24, 2018
Copy link
Contributor

@vilterp vilterp left a comment

Choose a reason for hiding this comment

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

Hoo, working with react router is always a little tricky, but this looks fine. Tested locally; works 👍

@couchand
Copy link
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request May 29, 2018
26053:  ui: redirect to login page when api call is unauthorized r=couchand a=couchand

#### ui: pass both api handlers in a single then call

Previously the API handlers in CachedDataReducer were attached with
a then followed by a catch, which meant errors in the dispatch of
success would show up as API errors erroneously.  This change moves
both handlers into a single invocation of then to fix the issue.

Release note: None

#### ui: redirect to login page when api call is unauthorized

When we get a 401 HTTP status code, redirect to the login
page.  Once logout is implemented, this should do that
instead, to make sure client-side state is clean.

Fixes: #25785
Release note: None

Co-authored-by: Andrew Couch <[email protected]>
@craig
Copy link
Contributor

craig bot commented May 29, 2018

Build succeeded

@craig craig bot merged commit 6526970 into cockroachdb:master May 29, 2018
craig bot pushed a commit that referenced this pull request May 31, 2018
26062: server, ui: logout r=vilterp a=vilterp

**implement logout endpoint on backend**

Because of grpc-ecosystem/grpc-gateway#470, had to do an end run around gRPC. We'll need to fix grpc-gateway to pass the context through eventually, but I don't want logout to be blocked on it.

**implement logout button on frontend**

Makes an RPC to invalidate the session. If successful, reloads the page.

Fixes #25784 
Produces awesomeness when combined with #26053 

Co-authored-by: Pete Vilter <[email protected]>
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.

ui: redirect to login page when api call is unauthorized
3 participants