- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스) - Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포 - 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
899 B
TypeScript
32 lines
899 B
TypeScript
import { useEffect } from 'react'
|
|
import { Stack, useRouter, useSegments } from 'expo-router'
|
|
import { StatusBar } from 'expo-status-bar'
|
|
import * as SplashScreen from 'expo-splash-screen'
|
|
import { AuthContext, useAuthState } from '../hooks/useAuth'
|
|
|
|
SplashScreen.preventAutoHideAsync()
|
|
|
|
export default function RootLayout() {
|
|
const auth = useAuthState()
|
|
const router = useRouter()
|
|
const segments = useSegments()
|
|
|
|
useEffect(() => {
|
|
if (auth.loading) return
|
|
SplashScreen.hideAsync()
|
|
const inAuth = segments[0] === '(auth)'
|
|
if (!auth.token && !inAuth) {
|
|
router.replace('/(auth)/login')
|
|
} else if (auth.token && inAuth) {
|
|
router.replace('/(tabs)')
|
|
}
|
|
}, [auth.loading, auth.token])
|
|
|
|
return (
|
|
<AuthContext.Provider value={auth}>
|
|
<StatusBar style="light" />
|
|
<Stack screenOptions={{ headerShown: false }} />
|
|
</AuthContext.Provider>
|
|
)
|
|
}
|