mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
31 lines
712 B
JavaScript
31 lines
712 B
JavaScript
import React, {Component, PropTypes} from 'react';
|
|
import CodeEditor from './base/Editor'
|
|
|
|
class RequestBodyEditor extends Component {
|
|
shouldComponentUpdate (nextProps) {
|
|
return this.props.request !== nextProps.request;
|
|
}
|
|
|
|
render () {
|
|
const {request, onChange, className} = this.props;
|
|
return (
|
|
<CodeEditor
|
|
value={request.body}
|
|
className={className}
|
|
onChange={onChange}
|
|
options={{mode: request._mode}}
|
|
/>
|
|
)
|
|
}
|
|
}
|
|
|
|
RequestBodyEditor.propTypes = {
|
|
request: PropTypes.shape({
|
|
body: PropTypes.string.isRequired,
|
|
_mode: PropTypes.string.isRequired
|
|
}).isRequired,
|
|
onChange: PropTypes.func.isRequired
|
|
};
|
|
|
|
export default RequestBodyEditor;
|