Создать PDF на React JS не работает - PullRequest
0 голосов
/ 12 мая 2018

У меня возникла эта проблема, когда я пытаюсь экспортировать отчет в формате PDF, который разрабатывается Jaspersoft® Studio, метод делает все, но он не загружает PDF

Я использую ReactionJS v16.0 и Spring Boot 2.0 использование весенней загрузки для генерации pdf и использование activjs для вызова rest api rest api

Детали моего кода ниже

Код реакции JS:

   export function* downloadMarkSheetByRollRange() {    
   const requestURL = "http://192.168.31.215:8083/marksheet/single/download?startRoll=1&endRoll=20&classConfigId=100148&examConfigId=53&marksheetYear=2017"
   const options = {
    method: 'GET',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    },
  };

  console.log(requestURL);
  const result = yield call(request, requestURL, options);
}

export default function* defaultSaga() {
  yield takeLatest(SUBMIT_DOWNLOAD, downloadMarkSheetByRollRange);

} 

Here is my index.js page

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { createStructuredSelector } from 'reselect';
import { compose } from 'redux';

import injectSaga from 'utils/injectSaga';
import injectReducer from 'utils/injectReducer';
import makeSelectGeneralExamMarkSheet from './selectors';
import reducer from './reducer';
import saga from './saga';
import messages from './messages';
import { Button } from 'primereact/components/button/Button';

export class GeneralExamMarkSheet extends React.Component { // eslint-disable-line react/prefer-stateless-function
  render() {   
 return (
      <div>
        <Panel header="General Exam MarkSheet" >
          <Button label="Download" icon="ui-icon-search" onClick = 
                {this.props.downloadMarkSheet} >
           </Button>
        </Panel>
     </div>
  );
 }
}

GeneralExamMarkSheet.propTypes = {};
const mapStateToProps = createStructuredSelector({});

function mapDispatchToProps(dispatch) {
  return {
          dispatch,
  };
}
const withConnect = connect(mapStateToProps, mapDispatchToProps);

const withReducer = injectReducer(
 { 
  key:'generalExamMarkSheet',reducer
 });
const withSaga = injectSaga({ key: 'generalExamMarkSheet', saga });

export default compose(
  withReducer,
  withSaga,
  withConnect,
)(GeneralExamMarkSheet);

Но когда я нажимаю http://192.168.31.215:8083/marksheet/single/download?startRoll=1&endRoll=20&classConfigId=100148&examConfigId=53&marksheetYear=2017 url в браузере, генерирую pdf

Вот мой ответ браузера, когда пытаешься реагировать js

enter image description here

Есть идеи?

...