mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
navigate to intro when the state actually changes
This commit is contained in:
parent
1d259137ee
commit
dc85e938bd
2 changed files with 7 additions and 4 deletions
|
|
@ -97,10 +97,6 @@ const App = () => {
|
|||
React.useEffect(() => {
|
||||
const onCoreEvent = ({ event, args }) => {
|
||||
switch (event) {
|
||||
case 'UserLoggedOut': {
|
||||
window.location = '#/intro';
|
||||
break;
|
||||
}
|
||||
case 'SettingsUpdated': {
|
||||
if (args && args.settings && typeof args.settings.interfaceLanguage === 'string') {
|
||||
i18n.changeLanguage(args.settings.interfaceLanguage);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,13 @@ const { useProfile } = require('stremio/common');
|
|||
const withProtectedRoutes = (Component) => {
|
||||
return function withProtectedRoutes(props) {
|
||||
const profile = useProfile();
|
||||
const previousProfileRef = React.useRef(null);
|
||||
React.useEffect(() => {
|
||||
if (previousProfileRef.current?.auth !== null && profile.auth === null) {
|
||||
window.location = '#/intro';
|
||||
}
|
||||
previousProfileRef.current = profile;
|
||||
}, [profile])
|
||||
const onRouteChange = React.useCallback((routeConfig) => {
|
||||
if (profile.auth !== null && routeConfig.component === Intro) {
|
||||
window.location.replace('#/');
|
||||
|
|
|
|||
Loading…
Reference in a new issue