You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
847 B
28 lines
847 B
import { Redirect } from 'expo-router';
|
|
import { useAuth } from '../src/context/AuthContext';
|
|
import { useRole } from '../src/context/RoleContext';
|
|
|
|
/**
|
|
* 应用总入口(根路由 /)。
|
|
* 按「引导 → 登录 → 选择身份 → 对应端」漏斗放行,保证每个页面都有合理的前置入口。
|
|
*/
|
|
export default function Index() {
|
|
const { onboardingSeen, isLoggedIn } = useAuth();
|
|
const { role } = useRole();
|
|
|
|
if (!onboardingSeen) {
|
|
return <Redirect href="/guide" />;
|
|
}
|
|
if (!isLoggedIn) {
|
|
return <Redirect href="/login" />;
|
|
}
|
|
if (!role) {
|
|
return <Redirect href="/identity-select" />;
|
|
}
|
|
// 两个路由组均无 index,必须用显式落地路由,否则落地页空白
|
|
return (
|
|
<Redirect
|
|
href={role === 'candidate' ? '/(tabs)/jobs' : '/(enterprise)/job-management'}
|
|
/>
|
|
);
|
|
}
|
|
|