import React, { PureComponent as Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux'; import { getToken } from '../../../client/reducer/modules/project.js' import './Services.scss'; @connect( state => { return { token: state.project.token } }, { getToken } ) export default class Services extends Component { static propTypes = { projectId: PropTypes.number, token: PropTypes.string, getToken: PropTypes.func } async componentDidMount() { const id = this.props.projectId; await this.props.getToken(id); } render () { const id = this.props.projectId; return (
{`
npm i sm2tsservice -D
`}
{`
touch json2service.json
`}
{`
{
"url": "yapi-swagger.json",
"remoteUrl": "${location.protocol}//${location.hostname}${location.port ? `:${location.port}` : ''}/api/open/plugin/export-full?type=json&pid=${id}&status=all&token=${this.props.token}",
"type": "yapi",
"swaggerParser": {}
}
`}
{`
touch json2service.json
`}
{`
{
"url": "${location.protocol}//${location.hostname}${location.port ? `:${location.port}` : ''}/api/open/plugin/export-full?type=json&pid=${id}&status=all&token=${this.props.token}",
"type": "yapi",
"swaggerParser": {}
}
`}
{`
(./node_modules/.bin/)sm2tsservice --clear
`}