Skip to content

Commit

Permalink
Fix typo in redirect script and fix basename
Browse files Browse the repository at this point in the history
  • Loading branch information
felipethome committed Feb 24, 2017
1 parent 7d9f0da commit fb80a10
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
lib
demo/build
demo/deploy
.publish
.DS_Store
package-backup-*.json
coverage
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
src
demo
build
.publish
.babelrc
.eslintrc.js
gulpfile.js
Expand Down
2 changes: 1 addition & 1 deletion demo/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* current URL in the sessionStorage so it can be retrieved later to finally
* access the page the client was asking for with client-routing.
*/
var savedSessionStorage = windows.sessionStorage || {};
var savedSessionStorage = window.sessionStorage || {};
savedSessionStorage.redirect = location.href;
</script>
<meta http-equiv="refresh" content="0;URL='/react-inline-transition-group'"></meta>
Expand Down
7 changes: 6 additions & 1 deletion demo/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export default class Demo extends React.Component {
},
};

const basename = (sessionStorage || {}).basename;

const navbarActions = [
<a
key="github"
Expand All @@ -51,7 +53,10 @@ export default class Demo extends React.Component {
];

return (
<Router forceRefresh={!supportsHistory}>
<Router
basename={basename}
forceRefresh={!supportsHistory}
>
<div style={styles.container}>
<Navbar actions={navbarActions} />
<Route exact path="/" component={Circle}/>
Expand Down
6 changes: 5 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@

<script>
(function (){
var savedSessionStorage = windows.sessionStorage || {};
var savedSessionStorage = window.sessionStorage || {};
var redirect = savedSessionStorage.redirect;
delete savedSessionStorage.redirect;
if (redirect && redirect != location.href && history) {
history.replaceState(null, null, redirect);
}

if (document.location.hostname == 'felipethome.github.io') {
savedSessionStorage.basename = '/react-inline-transition-group';
}
})();
</script>

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"clean": "rm -rf demo/{build,deploy}",
"demo": "gulp demo",
"deploy": "gulp deploy",
"ghpages": "gulp ghpages",
"lint": "eslint src/",
"test": "jest --verbose",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
Expand Down

0 comments on commit fb80a10

Please sign in to comment.