File tree Expand file tree Collapse file tree 5 files changed +201
-136
lines changed
AccountMyFormsEap/EapTableActions Expand file tree Collapse file tree 5 files changed +201
-136
lines changed Original file line number Diff line number Diff line change @@ -1226,30 +1226,16 @@ const eapDevelopmentRegistrationForm = customWrapRoute({
12261226 } ,
12271227} ) ;
12281228
1229- const eapFullExport = customWrapRoute ( {
1230- parent : rootLayout ,
1231- path : 'eap/:eapId/full/export' ,
1232- component : {
1233- render : ( ) => import ( '#views/EapFullExport' ) ,
1234- props : { } ,
1235- } ,
1236- wrapperComponent : Auth ,
1237- context : {
1238- title : 'Full EAP Export' ,
1239- visibility : 'is-authenticated' ,
1240- } ,
1241- } ) ;
1242-
1243- const simplifiedEapExport = customWrapRoute ( {
1229+ const eapExport = customWrapRoute ( {
12441230 parent : rootLayout ,
12451231 path : 'eap/:eapId/export' ,
12461232 component : {
1247- render : ( ) => import ( '#views/SimplifiedEapExport ' ) ,
1233+ render : ( ) => import ( '#views/EapExport ' ) ,
12481234 props : { } ,
12491235 } ,
12501236 wrapperComponent : Auth ,
12511237 context : {
1252- title : 'Simplified EAP Export' ,
1238+ title : 'EAP Export' ,
12531239 visibility : 'is-authenticated' ,
12541240 } ,
12551241} ) ;
@@ -1532,8 +1518,7 @@ const wrappedRoutes = {
15321518 drefProcessLayout,
15331519 eapRegistrationLayout,
15341520 eapDevelopmentRegistrationForm,
1535- simplifiedEapExport,
1536- eapFullExport,
1521+ eapExport,
15371522} ;
15381523
15391524export const unwrappedRoutes = unwrapRoute ( Object . values ( wrappedRoutes ) ) ;
Original file line number Diff line number Diff line change @@ -60,22 +60,9 @@ function EapTableActions(props: Props) {
6060 return (
6161 < >
6262 < ListView layout = "block" >
63- { type === 'development' && eap . eap_type === EAP_TYPE_SIMPLIFIED && (
64- < Link
65- to = "simplifiedEapExport"
66- urlParams = { { eapId : eap . id } }
67- urlSearch = { isDefined ( details ?. data . version )
68- ? `version=${ details . data . version } `
69- : undefined }
70- title = { strings . previewExportLink }
71- before = { < DocumentPdfLineIcon fontSize = { 18 } /> }
72- >
73- { strings . previewExportLink }
74- </ Link >
75- ) }
76- { type === 'development' && eap . eap_type === EAP_TYPE_FULL && (
63+ { type === 'development' && (
7764 < Link
78- to = "eapFullExport "
65+ to = "eapExport "
7966 urlParams = { { eapId : eap . id } }
8067 urlSearch = { isDefined ( details ?. data . version )
8168 ? `version=${ details . data . version } `
Original file line number Diff line number Diff line change 1+ import { useParams } from 'react-router-dom' ;
2+ import {
3+ isFalsyString ,
4+ isNotDefined ,
5+ isTruthyString ,
6+ } from '@togglecorp/fujs' ;
7+
8+ import { EAP_TYPE_FULL } from '#utils/constants' ;
9+ import { useRequest } from '#utils/restRequest' ;
10+ import EapFullExport from '#views/EapFullExport' ;
11+ import SimplifiedEapExport from '#views/SimplifiedEapExport' ;
12+
13+ /** @knipignore */
14+ // eslint-disable-next-line import/prefer-default-export
15+ export function Component ( ) {
16+ const { eapId } = useParams < { eapId : string } > ( ) ;
17+
18+ const { pending : eapRegistrationPending , response : eapRegistrationResponse } = useRequest ( {
19+ skip : isFalsyString ( eapId ) ,
20+ url : '/api/v2/eap-registration/{id}/' ,
21+ pathVariables : isTruthyString ( eapId )
22+ ? {
23+ id : Number ( eapId ) ,
24+ }
25+ : undefined ,
26+ } ) ;
27+
28+ const eapType = eapRegistrationResponse ?. eap_type ;
29+
30+ if ( isNotDefined ( eapRegistrationResponse ) ) {
31+ return null ;
32+ }
33+
34+ return eapType === EAP_TYPE_FULL ? (
35+ < EapFullExport
36+ eapRegistrationResponse = { eapRegistrationResponse }
37+ eapRegistrationPending = { eapRegistrationPending }
38+ />
39+ ) : (
40+ < SimplifiedEapExport
41+ eapRegistrationResponse = { eapRegistrationResponse }
42+ eapRegistrationPending = { eapRegistrationPending }
43+ />
44+ ) ;
45+ }
46+
47+ Component . displayName = 'EapExport' ;
You can’t perform that action at this time.
0 commit comments