@@ -6,6 +6,7 @@ module.exports = router => {
66 const data = req . session . data
77 const organisationCode = data . organisationCode
88 const organisation = data . organisations . find ( ( organisation ) => organisation . id === organisationCode )
9+ if ( ! organisation ) { res . redirect ( '/apply/start' ) ; return }
910
1011 res . render ( 'apply/check-pharmacy' , {
1112 organisation
@@ -17,19 +18,34 @@ module.exports = router => {
1718 const data = req . session . data
1819 const organisationCode = data . organisationCode
1920 const organisation = data . organisations . find ( ( organisation ) => organisation . id === organisationCode )
21+ if ( ! organisation ) { res . redirect ( '/apply/start' ) ; return }
2022
2123 res . render ( 'apply/check' , {
2224 organisation
2325 } )
2426 } )
2527
28+ // Check your email page
29+ router . get ( '/apply/check-your-email' , ( req , res ) => {
30+ const data = req . session . data
31+ const organisationCode = data . organisationCode
32+ const organisation = data . organisations . find ( ( organisation ) => organisation . id === organisationCode )
33+
34+ if ( ! organisation ) { res . redirect ( '/apply/start' ) ; return }
35+
36+ res . render ( 'apply/check-your-email' , {
37+ organisation
38+ } )
39+ } )
40+
2641
2742 // Routing after the final check answers page
2843 router . post ( '/apply/answer-check' , ( req , res ) => {
2944 const data = req . session . data
45+ const vaccineTypes = ( data . vaccineTypes || [ ] )
3046 let nextPage
3147
32- if ( data . vaccineTypes . includes ( 'COVID-19' ) && data . organisationCode === 'FA02S' ) {
48+ if ( vaccineTypes . includes ( 'COVID-19' ) && data . organisationCode === 'FA02S' ) {
3349 nextPage = '/apply/no-contract'
3450 } else {
3551 nextPage = '/apply/check-your-email'
@@ -43,6 +59,7 @@ module.exports = router => {
4359 const data = req . session . data
4460 const organisationCode = data . organisationCode
4561 const organisation = data . organisations . find ( ( organisation ) => organisation . id === organisationCode )
62+ if ( ! organisation ) { res . redirect ( '/apply/start' ) ; return }
4663
4764 res . render ( 'apply/welcome-email' , {
4865 organisation
0 commit comments