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

123 link auth to form #167

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open

123 link auth to form #167

wants to merge 7 commits into from

Conversation

benlittlenz
Copy link
Contributor

closes #123
User can now register an account and user data is sent back and displaying in the database

@benlittlenz benlittlenz self-assigned this Feb 26, 2019
@@ -21,6 +21,7 @@ export const registerError = error => {
}

export const register = (user) => dispatch => {
console.log(user)

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

@@ -1,5 +1,7 @@
import {setToken} from '../utils/tokens'
import {register as registerApi, signin as signinApi} from '../api/auth'
import {registerApi} from '../api/auth'

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?

@@ -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'

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'

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.

@@ -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')

Choose a reason for hiding this comment

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

Remove console.log

onChange={this.handleChange}
/>
<br/>
<br/>
<label htmlFor='role'>Role</label>
<br/>

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
}
}

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}) 😸

}

export default Register
/> */}

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

@@ -1,5 +1,6 @@
import {getToken} from '../utils/tokens'


Choose a reason for hiding this comment

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

Please undo this change.

@@ -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)

Choose a reason for hiding this comment

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

Please undo this change.

@benlittlenz
Copy link
Contributor Author

All changes made, now working with updated register form

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.

Link auth to registration form
2 participants