-
Notifications
You must be signed in to change notification settings - Fork 3
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
123 link auth to form #167
base: dev
Are you sure you want to change the base?
Conversation
client/actions/auth.js
Outdated
@@ -21,6 +21,7 @@ export const registerError = error => { | |||
} | |||
|
|||
export const register = (user) => dispatch => { | |||
console.log(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this console.log
client/actions/auth.js
Outdated
@@ -1,5 +1,7 @@ | |||
import {setToken} from '../utils/tokens' | |||
import {register as registerApi, signin as signinApi} from '../api/auth' | |||
import {registerApi} from '../api/auth' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
register
is a better name. Can you rename the function in the ../api/auth
file?
client/actions/auth.js
Outdated
@@ -1,5 +1,7 @@ | |||
import {setToken} from '../utils/tokens' | |||
import {register as registerApi, signin as signinApi} from '../api/auth' | |||
import {registerApi} from '../api/auth' | |||
import {signin as signinApi} from '../api/auth' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signin
is a better name. Can you rename the function in the ../api/auth
file?
import {register as registerApi, signin as signinApi} from '../api/auth' | ||
import {registerApi} from '../api/auth' | ||
import {signin as signinApi} from '../api/auth' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 2 consecutive blank lines? Your linter should complain about this.
client/api/auth.js
Outdated
@@ -2,7 +2,8 @@ import request from 'superagent' | |||
|
|||
const url = 'http://localhost:3000/api/v1/auth' | |||
|
|||
export function register (user) { | |||
export function registerApi (user) { | |||
console.log('hello') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log
client/components/Register.jsx
Outdated
onChange={this.handleChange} | ||
/> | ||
<br/> | ||
<br/> | ||
<label htmlFor='role'>Role</label> | ||
<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the <br />
tags and use CSS to create the space you need. This should be done for this whole component. Using elements and attributes for styling is an anti-pattern. CSS is more than capable these days 😉
return { | ||
auth | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to refactor lines 96-100, you can do it with one line: const mapStateToProps = ({auth}) => ({auth})
😸
client/components/Register.jsx
Outdated
} | ||
|
||
export default Register | ||
/> */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all of these comments
client/reducers/auth.js
Outdated
@@ -1,5 +1,6 @@ | |||
import {getToken} from '../utils/tokens' | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo this change.
server/routes/auth.js
Outdated
@@ -8,6 +8,7 @@ router.post('/register', register, token.issue) | |||
router.post('/login', validateLogin, checkUser, token.issue) | |||
|
|||
function register (req, res, next) { | |||
console.log(req.body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo this change.
All changes made, now working with updated register form |
closes #123
User can now register an account and user data is sent back and displaying in the database