mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
feat: 创建项目请求
This commit is contained in:
parent
5a074533ae
commit
dba1d60d26
24
client/actions/project.js
Normal file
24
client/actions/project.js
Normal file
@ -0,0 +1,24 @@
|
||||
import {
|
||||
PROJECT_ADD
|
||||
} from '../constants/action-types.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const addProject = (data) => {
|
||||
const { name, prd_host, basepath, desc } = data;
|
||||
const param = {
|
||||
name,
|
||||
prd_host,
|
||||
basepath,
|
||||
desc
|
||||
}
|
||||
console.log(param);
|
||||
return {
|
||||
type: PROJECT_ADD,
|
||||
// payload 可以返回 Promise,异步请求使用 axios 即可
|
||||
payload: axios.get('/project/add', param)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
addProject
|
||||
}
|
@ -7,9 +7,12 @@ export const PROJECT_MEMBER_INTERFACE = 'PROJECT_MEMBER_INTERFACE'
|
||||
export const FETCH_GROUP_LIST = 'FETCH_GROUP_LIST'
|
||||
export const FETCH_CURR_GROUP = 'FETCH_CURR_GROUP'
|
||||
|
||||
// project
|
||||
export const PROJECT_ADD = 'PROJECT_ADD'
|
||||
|
||||
// login
|
||||
export const LOGIN = 'LOGIN';
|
||||
export const REGISTER = 'REGISTER';
|
||||
|
||||
//header
|
||||
export const LOGIN_TYPE = 'LOGIN_TYPE';
|
||||
export const LOGIN_TYPE = 'LOGIN_TYPE';
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
// import { connect } from 'react-redux'
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { Table, Button, Modal, Form, Input, Icon, Tooltip } from 'antd';
|
||||
import { addProject } from '../../../actions/project';
|
||||
const { TextArea } = Input;
|
||||
const FormItem = Form.Item;
|
||||
|
||||
@ -47,6 +48,18 @@ const formItemLayout = {
|
||||
sm: { span: 14 }
|
||||
}
|
||||
};
|
||||
|
||||
@connect(
|
||||
state => {
|
||||
return {
|
||||
loginData: state.login
|
||||
}
|
||||
},
|
||||
{
|
||||
addProject
|
||||
}
|
||||
)
|
||||
|
||||
class ProjectList extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -55,7 +68,8 @@ class ProjectList extends Component {
|
||||
}
|
||||
}
|
||||
static propTypes = {
|
||||
form: PropTypes.object
|
||||
form: PropTypes.object,
|
||||
addProject: PropTypes.func
|
||||
}
|
||||
addProject = () => {
|
||||
this.setState({
|
||||
@ -70,6 +84,7 @@ class ProjectList extends Component {
|
||||
this.setState({
|
||||
visible: false
|
||||
});
|
||||
this.props.addProject(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user