From 85a1574d418e94cf2717a258ca6df4d6f2cfcb7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Thu, 2 Jul 2015 14:53:49 +0200 Subject: [PATCH] handle slide_num default for non-set queryParams --- .../ascribe_slides_container/slides_container.js | 9 +++++++-- js/components/register_piece.js | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/js/components/ascribe_slides_container/slides_container.js b/js/components/ascribe_slides_container/slides_container.js index 363d94ce..8969f77b 100644 --- a/js/components/ascribe_slides_container/slides_container.js +++ b/js/components/ascribe_slides_container/slides_container.js @@ -21,9 +21,8 @@ let SlidesContainer = React.createClass({ if(queryParams && 'slide_num' in queryParams) { slideNum = parseInt(queryParams.slide_num, 10); - } else { - console.warn('slide_num was\'t included as a queryParam. Defaulting to slide_num = 0'); } + // if slide_num is not set, this will be done in componentDidMount return { containerWidth: 0, @@ -32,6 +31,12 @@ let SlidesContainer = React.createClass({ }, componentDidMount() { + // check if slide_num was defined, and if not then default to 0 + let queryParams = this.getQuery(); + if(!('slide_num' in queryParams)) { + this.transitionTo(this.getPathname(), null, {slide_num: 0}); + } + // init container width this.handleContainerResize(); diff --git a/js/components/register_piece.js b/js/components/register_piece.js index b7d5aca4..827e9d71 100644 --- a/js/components/register_piece.js +++ b/js/components/register_piece.js @@ -100,7 +100,7 @@ let RegisterPiece = React.createClass( { } }, onLicenseChange(event){ - console.log(this.state.licenses[event.target.selectedIndex].url); + //console.log(this.state.licenses[event.target.selectedIndex].url); this.setState({selectedLicense: event.target.selectedIndex}); }, getLicenses() { @@ -201,7 +201,7 @@ let RegisterPiece = React.createClass( {
- chellas +
);