onPathNotMatch moved out of route config

This commit is contained in:
NikolaBorislavovHristov 2019-05-09 12:38:48 +03:00
parent 83e225aecc
commit b405fce103
2 changed files with 18 additions and 16 deletions

View file

@ -1,17 +1,23 @@
const React = require('react'); const React = require('react');
const { Router } = require('stremio-navigation'); const { Router } = require('stremio-navigation');
const { homePath, onPathNotMatch, views: viewsConfig } = require('./routerConfig'); const routerConfig = require('./routerConfig');
const styles = require('./styles'); const styles = require('./styles');
const App = () => ( const App = () => {
<React.StrictMode> const onPathNotMatch = React.useCallback(() => {
<Router window.history.back();
className={styles['router']} }, []);
homePath={homePath}
viewsConfig={viewsConfig} return (
onPathNotMatch={onPathNotMatch} <React.StrictMode>
/> <Router
</React.StrictMode> className={styles['router']}
); homePath={routerConfig.homePath}
viewsConfig={routerConfig.views}
onPathNotMatch={onPathNotMatch}
/>
</React.StrictMode>
);
};
module.exports = App; module.exports = App;

View file

@ -45,12 +45,8 @@ const views = [
} }
] ]
]; ];
const onPathNotMatch = () => {
window.history.back();
};
module.exports = { module.exports = {
homePath, homePath,
views, views
onPathNotMatch
}; };