|
|
@@ -10,6 +10,8 @@ import gql from "graphql-tag";
|
|
|
import _ from 'lodash';
|
|
|
import {idGen} from "../func";
|
|
|
import {setCookie} from "../cookie";
|
|
|
+import {loginUrl, registerUrl, getIdUrl} from '../config'
|
|
|
+import {graphqlUrl} from "../config";
|
|
|
|
|
|
axios.defaults.withCredentials = true;
|
|
|
|
|
|
@@ -28,9 +30,6 @@ class LoginInput extends Component {
|
|
|
register_nickname: '',
|
|
|
login_username: '',
|
|
|
login_password: '',
|
|
|
- login_url: 'http://123.206.193.98:8999/login',
|
|
|
- register_url: 'http://123.206.193.98:8999/resetpassword',
|
|
|
- getID_url: 'http://123.206.193.98:8999/getuserid',
|
|
|
loginStatus: '',
|
|
|
loginOnce: true,
|
|
|
usernameTip: false
|
|
|
@@ -41,7 +40,7 @@ class LoginInput extends Component {
|
|
|
login = () => {
|
|
|
let _this = this;
|
|
|
|
|
|
- axios.post(this.state.login_url, {
|
|
|
+ axios.post(loginUrl, {
|
|
|
'user-name': this.state.login_username,
|
|
|
password: this.state.login_password
|
|
|
})
|
|
|
@@ -53,7 +52,7 @@ class LoginInput extends Component {
|
|
|
});
|
|
|
setCookie("user_id", res.data);
|
|
|
_this.props.getUserId(res.data);
|
|
|
- request('http://123.206.193.98:3000/graphql', GET_USER, {id: res.data}).then(data => {
|
|
|
+ request(graphqlUrl, GET_USER, {id: res.data}).then(data => {
|
|
|
this.setState({
|
|
|
avatar: data.user_by_id.avatar,
|
|
|
nickname: data.user_by_id.nickname
|
|
|
@@ -123,7 +122,7 @@ class LoginInput extends Component {
|
|
|
/>
|
|
|
</div>
|
|
|
<Button type='primary' onClick={() => {
|
|
|
- request('http://123.206.193.98:3000/graphql', SEARCH_USER, {username: this.state.register_username}).then(data => {
|
|
|
+ request(graphqlUrl, SEARCH_USER, {username: this.state.register_username}).then(data => {
|
|
|
if (data.user_by_props.length === 0) {
|
|
|
let id = idGen('user');
|
|
|
let _this = this;
|
|
|
@@ -141,7 +140,7 @@ class LoginInput extends Component {
|
|
|
avatar: ''
|
|
|
}
|
|
|
});
|
|
|
- axios.post(this.state.register_url,
|
|
|
+ axios.post(registerUrl,
|
|
|
{
|
|
|
'user-id': id,
|
|
|
password: this.state.register_password,
|
|
|
@@ -179,7 +178,7 @@ class LoginInput extends Component {
|
|
|
|
|
|
componentWillMount() {
|
|
|
let _this = this;
|
|
|
- axios.get(this.state.getID_url)
|
|
|
+ axios.get(getIdUrl)
|
|
|
.then((res) => {
|
|
|
if (res.data !== '') {
|
|
|
setCookie("user_id", res.data);
|
|
|
@@ -189,7 +188,7 @@ class LoginInput extends Component {
|
|
|
loginOnce: false,
|
|
|
loginStatus: 'logined'
|
|
|
}, () => {
|
|
|
- request('http://123.206.193.98:3000/graphql', GET_USER, {id: res.data}).then(data => {
|
|
|
+ request(graphqlUrl, GET_USER, {id: res.data}).then(data => {
|
|
|
this.setState({
|
|
|
avatar: data.user_by_id.avatar,
|
|
|
nickname: data.user_by_id.nickname
|