Skip to content

Commit

Permalink
installed redux-thunk and axios. built auth actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxnelson997 committed Jun 12, 2018
1 parent 81d41e3 commit 5ac8249
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 4 deletions.
16 changes: 14 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"dependencies": {
"autoprefixer": "^7.1.2",
"axios": "^0.18.0",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
Expand Down Expand Up @@ -65,6 +66,7 @@
"reactstrap": "^5.0.0-alpha.4",
"redux": "^3.7.2",
"redux-form": "^7.3.0",
"redux-thunk": "^2.3.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
Expand Down
17 changes: 17 additions & 0 deletions src/actions/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import axios from 'axios';

import { ROOT_URL } from '../config';

export function signUp(fields, success) {
console.log(fields);
return function(dispatch) {
// axios.post(`${ROOT_URL}/signUp`, fields)
// .then(response => {
// //do something with response
// })
// .catch(err => {
// if(err) { console.log(err) }
// })
}
}
7 changes: 7 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {
signUp
} from './auth';

export {
signUp
};
7 changes: 6 additions & 1 deletion src/components/auth/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import React, { Component } from 'react';
import SignupForm from './signupForm';

class Signup extends Component {

onSubmit = (fields) => {

}

render() {
return (
<div className='sign-up'>
<SignupForm/>
<SignupForm onSubmit={(event) => this.onSubmit(event)}/>
</div>
)
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/auth/signupForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import TextLink from "../textLink";

class SignupForm extends Component {
render() {

const { handleSubmit } = this.props;

return (
<form className="sign-up-form">
<form onSubmit={handleSubmit} className="sign-up-form">
<FormTitle className="sign-up-form__title" text="New User" />
<Field
className="sign-up-form__fullname"
Expand Down
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const ROOT_URL = 'localhost:3090';

0 comments on commit 5ac8249

Please sign in to comment.