feat: 登录时记住密码

This commit is contained in:
wenbo.dong 2017-07-13 16:58:39 +08:00
parent 809f2835a7
commit b6fe780097
3 changed files with 9 additions and 8 deletions

View File

@ -4,20 +4,23 @@ import {
LOGIN_TYPE
} from '../constants/action-types.js';
import axios from 'axios';
import Cookies from 'universal-cookie';
const cookies = new Cookies();
const loginActions = (data) => {
axios.get('/user/login', data).then((res) => {
return (dispatch) => {
return (dispatch) => {
axios.get('/user/login', data).then((res) => {
cookies.set(data.email, data.password);
dispatch({
type: LOGIN,
payload: {
data: res
}
});
}
}).catch((err) => {
console.log(err);
});
}).catch((err) => {
console.log(err);
});
}
}
const regActions = (data) => {

View File

@ -53,7 +53,6 @@ class Login extends Component {
<FormItem>
{getFieldDecorator('email', {
rules: [{ required: true, message: '请输入email!' }],
initialValue: 'test',
onChange(e) {
that.handleChange(e.target.value);
}

View File

@ -53,7 +53,6 @@ class Login extends Component {
<FormItem>
{getFieldDecorator('email', {
rules: [{ required: true, message: '请输入email!' }],
initialValue: 'test',
onChange(e) {
that.handleChange(e.target.value);
}