Skip to content

Commit

Permalink
refactor the code
Browse files Browse the repository at this point in the history
Relates #38
  • Loading branch information
alaa-yasin committed Oct 2, 2019
1 parent 0a068bc commit 4a713be
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/src/components/pages/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Login extends React.Component {
e.preventDefault();
const { tableNumber, secret } = this.state;
const { history, updateTableNumber } = this.props;
logInSchema
return logInSchema
.validateAsync({ tableNumber, secret })
.then(() => {
return fetch('/api/v1/login', {
Expand All @@ -37,11 +37,11 @@ export default class Login extends React.Component {
}),
});
})
.then((res => {
.then(res => {
if (res.status === 200) {
updateTableNumber(tableNumber, history.push);
} else
return this.setState({ err: 'Incorrect Table Number or Secret' });
return updateTableNumber(tableNumber, history.push);
}
return this.setState({ err: 'Incorrect Table Number or Secret' });
})
.catch(err => {
if (err.details) {
Expand Down

0 comments on commit 4a713be

Please sign in to comment.