chart data loading
This commit is contained in:
@@ -40,11 +40,18 @@ watch(isMobile, (mobile) => {
|
||||
// Check if user is already authenticated on page load
|
||||
onMounted(async () => {
|
||||
// Try to restore session from stored token
|
||||
if (authService.getToken()) {
|
||||
const token = authService.getToken()
|
||||
if (token) {
|
||||
const sessionValid = await authService.checkAuth()
|
||||
if (sessionValid) {
|
||||
isAuthenticated.value = true
|
||||
await initializeApp()
|
||||
// Connect WebSocket with existing token
|
||||
try {
|
||||
await wsManager.connect(token)
|
||||
await initializeApp()
|
||||
} catch (err) {
|
||||
console.error('Failed to connect WebSocket on session restore:', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +77,8 @@ const handleAuthenticate = async (email: string, password: string) => {
|
||||
return
|
||||
}
|
||||
|
||||
// Step 2: Connect WebSocket with JWT token (if WebSocket is used for real-time sync)
|
||||
// For now, we're not connecting WebSocket until it's implemented in the gateway
|
||||
// await wsManager.connect(result.token)
|
||||
// Step 2: Connect WebSocket with JWT token for real-time sync
|
||||
await wsManager.connect(result.token)
|
||||
|
||||
// Step 3: Initialize application
|
||||
await initializeApp()
|
||||
|
||||
Reference in New Issue
Block a user