From fee0afe984b6ca90984f48894aa25465f2be6328 Mon Sep 17 00:00:00 2001 From: martyncolmer Date: Wed, 1 Dec 2021 09:59:04 +0000 Subject: [PATCH] fix for end of section --- .../routing2/translateRoutingDestination/index.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js index c40ea2a9..1443be60 100644 --- a/src/eq_schema/builders/routing2/translateRoutingDestination/index.js +++ b/src/eq_schema/builders/routing2/translateRoutingDestination/index.js @@ -54,11 +54,18 @@ const getLogicalDestination = (pageId, { logical }, ctx) => { ? "summary-group" : "confirmation-group", }; - } else if (logical === "NextPage") { + } + + if (logical === "NextPage") { return getNextPageDestination(pageId, ctx); - } else { - throw new Error(`${logical} is not a valid destination type`); + } + + if (logical === "EndOfCurrentSection") { + return { section: "End"} } + + throw new Error(`${logical} is not a valid destination type`); + }; const translateRoutingDestination = (destination, pageId, ctx) => {