Skip to content

Commit

Permalink
Admin UI: improved error handling on signin page (#2944)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed May 12, 2020
1 parent a124417 commit d60e2ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-trees-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystonejs/app-admin-ui': patch
---

Improved error handling on Signin page.
8 changes: 2 additions & 6 deletions packages/app-admin-ui/client/pages/Signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ const SignInPage = () => {

const [signIn, { error, loading, client }] = useMutation(AUTH_MUTATION, {
variables: { identity, secret },
onCompleted: ({ error }) => {
if (error) {
throw error;
}

onCompleted: () => {
// Ensure there's no old unauthenticated data hanging around
client.resetStore();

Expand All @@ -108,7 +104,7 @@ const SignInPage = () => {
// Let the server-side redirects kick in to send the user to the right place
window.location.reload(true);
},
onError: console.error,
onError: () => {}, // Remove once a bad password no longer throws an error
});

const onSubmit = e => {
Expand Down
7 changes: 1 addition & 6 deletions packages/app-admin-ui/client/pages/Signout.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,10 @@ const SignedOutPage = () => {
`;

const [signOut, { loading, client, called }] = useMutation(UNAUTH_MUTATION, {
onCompleted: ({ error }) => {
if (error) {
throw error;
}

onCompleted: () => {
// Ensure there's no old authenticated data hanging around
client.resetStore();
},
onError: console.error,
});

if (!called) {
Expand Down

0 comments on commit d60e2ca

Please sign in to comment.