diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-24 12:27:47 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-24 12:28:21 +0100 |
| commit | a6793f922991d326eeb33cf08b245863218eaef7 (patch) | |
| tree | cddce890107a6bf29f283147b54acd0a71393768 | |
| parent | b5435cf3a892efdef3efe0a137076b3408556434 (diff) | |
fix open page weirdness in a hacky way
| -rw-r--r-- | frontend/app/views/graph/graph.actions.js | 5 | ||||
| -rw-r--r-- | frontend/app/views/page/components/page.header.js | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/frontend/app/views/graph/graph.actions.js b/frontend/app/views/graph/graph.actions.js index 4185386..6d5cb51 100644 --- a/frontend/app/views/graph/graph.actions.js +++ b/frontend/app/views/graph/graph.actions.js @@ -41,10 +41,11 @@ export const setHomePageId = (graph, page) => dispatch => { actions.graph.update(updated_graph) } -export const viewPage = (graph, page) => dispatch => { +export const viewPage = (graph, path) => dispatch => { + // for some reason page.show.res is not always set..?? api(dispatch, types.api, 'export', `/api/v1/graph/export/${graph.path}`) .then(result => { console.log(result) - window.open(`${process.env.EXPORT_HOST}/${graph.path}/${page.path}`) + window.open(`${process.env.EXPORT_HOST}${path}`) }) } diff --git a/frontend/app/views/page/components/page.header.js b/frontend/app/views/page/components/page.header.js index d40f6e0..6df3ee5 100644 --- a/frontend/app/views/page/components/page.header.js +++ b/frontend/app/views/page/components/page.header.js @@ -29,7 +29,7 @@ function PageHeader(props) { <button onClick={() => props.pageActions.toggleTileList()}>Sort tiles</button> <button onClick={() => props.pageActions.togglePopups()}>Toggle popups</button> <button onClick={() => props.graphActions.toggleEditPageForm()}>Edit page</button> - <button onClick={() => props.graphActions.viewPage(props.graph, props.page)}>View page</button> + <button onClick={() => props.graphActions.viewPage(props.graph, props.router.location.pathname)}>View page</button> </div> </header> ) @@ -41,6 +41,7 @@ const mapStateToProps = (state) => ({ graph: state.graph.show.res, page: state.page.show.res, building: state.graph.editor.building, + router: state.router, // isAuthenticated: state.auth.isAuthenticated, }) |
