mirror of
https://github.com/ascribe/onion.git
synced 2024-12-23 01:39:36 +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) {
|
if(queryParams && 'slide_num' in queryParams) {
|
||||||
slideNum = parseInt(queryParams.slide_num, 10);
|
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 {
|
return {
|
||||||
containerWidth: 0,
|
containerWidth: 0,
|
||||||
@ -32,6 +31,12 @@ let SlidesContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount() {
|
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
|
// init container width
|
||||||
this.handleContainerResize();
|
this.handleContainerResize();
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ let RegisterPiece = React.createClass( {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLicenseChange(event){
|
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});
|
this.setState({selectedLicense: event.target.selectedIndex});
|
||||||
},
|
},
|
||||||
getLicenses() {
|
getLicenses() {
|
||||||
@ -201,7 +201,7 @@ let RegisterPiece = React.createClass( {
|
|||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
chellas
|
<LoginContainer/>
|
||||||
</div>
|
</div>
|
||||||
</SlidesContainer>
|
</SlidesContainer>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user