子账号登录微信授权
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||
import { usePartnerSession } from './contexts/PartnerSessionContext';
|
||||
import { isLoggedIn } from './lib/api';
|
||||
import { isSubAccount } from './lib/partnerAccess';
|
||||
import TabLayout from './layouts/TabLayout';
|
||||
import SubAccountLayout from './layouts/SubAccountLayout';
|
||||
@@ -19,10 +18,6 @@ import LeaderboardPage from './pages/LeaderboardPage';
|
||||
import StaffListPage from './pages/StaffListPage';
|
||||
import StaffCreatePage from './pages/StaffCreatePage';
|
||||
|
||||
function SessionLoading() {
|
||||
return <div className="empty">加载中...</div>;
|
||||
}
|
||||
|
||||
function PrimaryRoutes() {
|
||||
return (
|
||||
<Routes>
|
||||
@@ -61,14 +56,12 @@ function SubAccountRoutes() {
|
||||
}
|
||||
|
||||
export default function PartnerAppRoutes() {
|
||||
const { account, loading, loggedIn } = usePartnerSession();
|
||||
const { account, authenticated } = usePartnerSession();
|
||||
|
||||
if (!loggedIn && !isLoggedIn()) {
|
||||
return <Navigate to="/login" replace />;
|
||||
}
|
||||
if (loading) {
|
||||
return <SessionLoading />;
|
||||
if (!authenticated) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isSubAccount(account)) {
|
||||
return <SubAccountRoutes />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user