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 { Router } = require('stremio-navigation');
const { homePath, onPathNotMatch, views: viewsConfig } = require('./routerConfig');
const routerConfig = require('./routerConfig');
const styles = require('./styles');
const App = () => (
<React.StrictMode>
<Router
className={styles['router']}
homePath={homePath}
viewsConfig={viewsConfig}
onPathNotMatch={onPathNotMatch}
/>
</React.StrictMode>
);
const App = () => {
const onPathNotMatch = React.useCallback(() => {
window.history.back();
}, []);
return (
<React.StrictMode>
<Router
className={styles['router']}
homePath={routerConfig.homePath}
viewsConfig={routerConfig.views}
onPathNotMatch={onPathNotMatch}
/>
</React.StrictMode>
);
};
module.exports = App;

View file

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