mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 13:40:24 +02:00
Fix action required for mpv
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import isElectron from 'is-electron';
|
||||
import { Navigate, Outlet, useLocation } from 'react-router-dom';
|
||||
import { settings } from '@/renderer/features/settings';
|
||||
import { localSettings } from '@/renderer/features/settings';
|
||||
import { useServerCredential } from '@/renderer/features/shared';
|
||||
import { AppRoute } from '@/renderer/router/routes';
|
||||
import { useAuthStore } from '@/renderer/store';
|
||||
@@ -24,7 +24,7 @@ export const AppOutlet = ({ redirectTo }: PrivateOutletProps) => {
|
||||
useEffect(() => {
|
||||
const getMpvPath = async () => {
|
||||
if (!isElectron()) return setIsMpvRequired(false);
|
||||
const mpvPath = await settings.get('mpv_path');
|
||||
const mpvPath = await localSettings.get('mpv_path');
|
||||
return setIsMpvRequired(!mpvPath);
|
||||
};
|
||||
|
||||
@@ -34,10 +34,6 @@ export const AppOutlet = ({ redirectTo }: PrivateOutletProps) => {
|
||||
const actions = [isServerRequired, isCredentialRequired, isMpvRequired];
|
||||
const actionRequired = actions.some((c) => c);
|
||||
|
||||
if (isAuthenticated) {
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
if (isAuthenticated && actionRequired) {
|
||||
return (
|
||||
<Navigate
|
||||
@@ -48,6 +44,10 @@ export const AppOutlet = ({ redirectTo }: PrivateOutletProps) => {
|
||||
);
|
||||
}
|
||||
|
||||
if (isAuthenticated) {
|
||||
return <Outlet />;
|
||||
}
|
||||
|
||||
logout();
|
||||
return <Navigate replace state={{ from: location }} to={redirectTo} />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user