Refactor server and API handler for improved error handling and routing logic. Updated request handling to use Incoming type and added HTTP/1.1 restriction. Enhanced splash screen logic in the frontend to manage routing based on onboarding and setup states. Fixed WebSocket client initialization to ensure lazy loading and error handling. Cleaned up unused imports and variables across multiple files.
This commit is contained in:
+35
-6
@@ -35,8 +35,12 @@ onMounted(() => {
|
||||
if (seenIntro || isDirectRoute) {
|
||||
showSplash.value = false
|
||||
document.body.classList.add('splash-complete')
|
||||
// Set isReady immediately for direct routes or when intro is already seen
|
||||
// Router will handle navigation
|
||||
isReady.value = true
|
||||
}
|
||||
// If splash should show, wait for it to complete
|
||||
// SplashScreen will emit 'complete' which calls handleSplashComplete
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -47,13 +51,38 @@ function handleSplashComplete() {
|
||||
showSplash.value = false
|
||||
document.body.classList.add('splash-complete')
|
||||
|
||||
// Determine destination based on onboarding status
|
||||
const seenOnboarding = localStorage.getItem('neode_onboarding_complete') === '1'
|
||||
const destination = seenOnboarding ? '/login' : '/onboarding/intro'
|
||||
// Set isReady first so RouterView can render
|
||||
isReady.value = true
|
||||
|
||||
// Route immediately for seamless video transition (no delay needed)
|
||||
router.push(destination).then(() => {
|
||||
// Mark as ready after navigation completes
|
||||
// Determine destination based on onboarding status and dev mode
|
||||
const devMode = import.meta.env.VITE_DEV_MODE
|
||||
const seenOnboarding = localStorage.getItem('neode_onboarding_complete') === '1'
|
||||
const isSetup = localStorage.getItem('neode_setup_complete') === '1'
|
||||
|
||||
let destination = '/'
|
||||
|
||||
// Setup mode: always go to login
|
||||
if (devMode === 'setup') {
|
||||
destination = '/login'
|
||||
}
|
||||
// Onboarding mode: go to onboarding if not seen
|
||||
else if (devMode === 'onboarding') {
|
||||
destination = seenOnboarding ? '/login' : '/onboarding/intro'
|
||||
}
|
||||
// Existing user mode: go to login
|
||||
else if (devMode === 'existing') {
|
||||
destination = '/login'
|
||||
}
|
||||
// Default: check onboarding status
|
||||
else {
|
||||
destination = seenOnboarding ? '/login' : '/onboarding/intro'
|
||||
}
|
||||
|
||||
// Route after a brief delay to ensure RouterView is mounted
|
||||
// The router's redirect will handle the actual navigation
|
||||
router.push(destination).catch(err => {
|
||||
console.error('Navigation error:', err)
|
||||
// Still show the app even if navigation fails
|
||||
isReady.value = true
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user