Navigate to Next Page in Program

Description: When a user attempts to go to the `next` page, we follow this logic:

“`
If there are required questions that have not been answered, stay on the current page and display a message to the user about the required answers

Else call `/api/pages//next`

If the next response is successful and has `page` data _and_ the `page` is a reference node (i.e. the `referenced_tree_id` is defined) the user is forwarded to the referenced tree

If the next response is successful and has `page` data, use the returned `page` data to render the page

If the next response is successful and *does not* have `page` data, attempt to load the parent content session and go to the current page of that content session

If there are no more pages left (either in the parent content session or there is no `next` page go to the program finish page

If the next response responds with a 403 error, the content is license restricted and we take the user to a content restricted view

If the next response responds with an error and has a `data.meta.code` of `precondition_failed` display a message to the user about the failed prerequisites
“`

Required Question Story: https://www.pivotaltracker.com/story/show/150068504
Child Content Session: https://www.pivotaltracker.com/story/show/149934920
Reference Program: https://www.pivotaltracker.com/story/show/150066877
Restricted Content: https://www.pivotaltracker.com/story/show/150066590

– Client will get a 204 error at the end of a tree and then we check to see if there is a parent content session.

This is really the core of the complexity when it comes to program navigation. These files may be useful as you work through this and want to (attempt to) understand what is happening in web:

– https://github.com/TangoGroup/polymer/blob/mainline/epoxy/app/core/routes/content-routes.js
– https://github.com/TangoGroup/polymer/blob/mainline/epoxy/app/core/services/content-routing-service.js
– https://github.com/TangoGroup/polymer/blob/mainline/epoxy/app/core/services/tree-consumption-service.js
– https://github.com/TangoGroup/polymer/blob/mainline/epoxy/app/core/services/api/v1/content-service.js
Owner: Brian McEvoy