mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
handle slide_num default for non-set queryParams
This commit is contained in:
parent
cb996566c7
commit
85a1574d41
@ -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();
|
||||
|
||||
|
@ -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( {
|
||||
</Form>
|
||||
</div>
|
||||
<div>
|
||||
chellas
|
||||
<LoginContainer/>
|
||||
</div>
|
||||
</SlidesContainer>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user