diff --git a/client/containers/AddInterface/InterfaceTest/InterfaceTest.js b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js index ae5f1161..f02c19df 100644 --- a/client/containers/AddInterface/InterfaceTest/InterfaceTest.js +++ b/client/containers/AddInterface/InterfaceTest/InterfaceTest.js @@ -85,8 +85,7 @@ export default class InterfaceTest extends Component { data: { a:1 }, - success: (res, header) => { - console.log(header) + success: (res) => { this.setState({res}) } }) diff --git a/client/containers/AddInterface/MockUrl/MockUrl.js b/client/containers/AddInterface/MockUrl/MockUrl.js index cfc8b81b..0dce9dac 100644 --- a/client/containers/AddInterface/MockUrl/MockUrl.js +++ b/client/containers/AddInterface/MockUrl/MockUrl.js @@ -24,7 +24,7 @@ class MockUrl extends Component { clipboard () { const btn = document.querySelector('#mock-clipboard') const txt = document.querySelector('#mock-p').innerHTML - console.log('txt', txt) + new Clipboard(btn, { text: () => txt, target () { diff --git a/client/containers/AddInterface/ReqHeader/ReqList.js b/client/containers/AddInterface/ReqHeader/ReqList.js index 21db94e1..47e8da5a 100644 --- a/client/containers/AddInterface/ReqHeader/ReqList.js +++ b/client/containers/AddInterface/ReqHeader/ReqList.js @@ -6,7 +6,8 @@ import { autobind } from 'core-decorators' import { reqTagValue, reqHeaderValue, - deleteReqHeader + deleteReqHeader, + addReqHeader } from '../../../actions/addInterface.js' @connect( @@ -20,7 +21,8 @@ import { { reqTagValue, reqHeaderValue, - deleteReqHeader + deleteReqHeader, + addReqHeader } ) @@ -30,6 +32,7 @@ class ReqList extends Component { reqTagValue: PropTypes.func, reqHeaderValue: PropTypes.func, deleteReqHeader: PropTypes.func, + addReqHeader: PropTypes.func, _id: PropTypes.number, dataNum: PropTypes.number, value: PropTypes.object @@ -43,12 +46,20 @@ class ReqList extends Component { handleChange (value) { const dir = 'AddInterface/edit' const url = location.href + const newObject = [] + if (url.includes(dir)) { const { seqGroup, value: { id } } = this.props seqGroup[id].name = value + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader( newObject ) } else { const { seqGroup, dataNum } = this.props seqGroup[dataNum].name = value + this.props.addReqHeader(Object.create(seqGroup)) } } @@ -56,7 +67,13 @@ class ReqList extends Component { handleBlur (e) { const value = e.target.value const { seqGroup, value: { id } } = this.props + const newObject = [] seqGroup[id].value = value + seqGroup.forEach(v => { + const {id, name, value} = v + newObject.push({id, name, value}) + }) + this.props.addReqHeader(newObject) } @autobind @@ -82,7 +99,7 @@ class ReqList extends Component { return (