feat: update routes with color and direction, improve admin routes view, and update firebase config/auth
This commit is contained in:
@ -0,0 +1,25 @@
|
|||||||
|
"""Add color and direction to routes
|
||||||
|
|
||||||
|
Revision ID: ffcd1234abcd
|
||||||
|
Revises: 3fe72cd3f722
|
||||||
|
Create Date: 2026-02-24 16:50:00.000000
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import sqlmodel
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = 'ffcd1234abcd'
|
||||||
|
down_revision: Union[str, None] = '3fe72cd3f722'
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.add_column('routes', sa.Column('color', sqlmodel.sql.sqltypes.AutoString(), nullable=True, server_default='#FEE715'))
|
||||||
|
op.add_column('routes', sa.Column('direction', sqlmodel.sql.sqltypes.AutoString(), nullable=True, server_default='outbound'))
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_column('routes', 'direction')
|
||||||
|
op.drop_column('routes', 'color')
|
||||||
@ -24,6 +24,8 @@ class Route(SQLModel, table=True):
|
|||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
origin_city: str
|
origin_city: str
|
||||||
destination_city: str
|
destination_city: str
|
||||||
|
color: str = Field(default="#FEE715")
|
||||||
|
direction: str = Field(default="outbound")
|
||||||
distance_km: Optional[float] = None
|
distance_km: Optional[float] = None
|
||||||
estimated_duration_minutes: Optional[int] = None
|
estimated_duration_minutes: Optional[int] = None
|
||||||
average_speed_kmh: Optional[float] = None
|
average_speed_kmh: Optional[float] = None
|
||||||
|
|||||||
@ -12,6 +12,8 @@ class RouteBase(BaseModel):
|
|||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
origin_city: str
|
origin_city: str
|
||||||
destination_city: str
|
destination_city: str
|
||||||
|
color: Optional[str] = "#FEE715"
|
||||||
|
direction: Optional[str] = "outbound"
|
||||||
distance_km: Optional[float] = None
|
distance_km: Optional[float] = None
|
||||||
estimated_duration_minutes: Optional[int] = None
|
estimated_duration_minutes: Optional[int] = None
|
||||||
average_speed_kmh: Optional[float] = None
|
average_speed_kmh: Optional[float] = None
|
||||||
@ -29,6 +31,8 @@ class RouteUpdate(BaseModel):
|
|||||||
description: Optional[str] = None
|
description: Optional[str] = None
|
||||||
origin_city: Optional[str] = None
|
origin_city: Optional[str] = None
|
||||||
destination_city: Optional[str] = None
|
destination_city: Optional[str] = None
|
||||||
|
color: Optional[str] = None
|
||||||
|
direction: Optional[str] = None
|
||||||
distance_km: Optional[float] = None
|
distance_km: Optional[float] = None
|
||||||
estimated_duration_minutes: Optional[int] = None
|
estimated_duration_minutes: Optional[int] = None
|
||||||
average_speed_kmh: Optional[float] = None
|
average_speed_kmh: Optional[float] = None
|
||||||
@ -47,4 +51,3 @@ class RouteResponse(RouteBase):
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"hosting": {
|
"hosting": {
|
||||||
"public": "dist",
|
"public": "dist",
|
||||||
|
"cleanUrls": true,
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"firebase.json",
|
"firebase.json",
|
||||||
"**/.*",
|
"**/.*",
|
||||||
@ -8,7 +9,7 @@
|
|||||||
],
|
],
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
{
|
||||||
"source": "**",
|
"source": "!{/__/**,/__}",
|
||||||
"destination": "/index.html"
|
"destination": "/index.html"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -15,18 +15,18 @@ const errorMessage = ref('')
|
|||||||
const showPassword = ref(false)
|
const showPassword = ref(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
console.log('Iniciando Login con correo...')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await authService.login({
|
const response = await authService.login({
|
||||||
// CRÍTICO: enviar email en minúsculas para evitar mismatch con el backend
|
|
||||||
email: email.value.trim().toLowerCase(),
|
email: email.value.trim().toLowerCase(),
|
||||||
password: password.value,
|
password: password.value,
|
||||||
keep_session: keepSession.value
|
keep_session: keepSession.value
|
||||||
})
|
})
|
||||||
|
console.log('Backend login exitoso:', response)
|
||||||
|
|
||||||
authStore.login(response.access_token, response.role, response.full_name)
|
authStore.login(response.access_token, response.role, response.full_name)
|
||||||
|
|
||||||
@ -37,12 +37,13 @@ const handleLogin = async () => {
|
|||||||
else router.push('/map')
|
else router.push('/map')
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error('Error Login detallado:', error)
|
||||||
if (!error.response) {
|
if (!error.response) {
|
||||||
errorMessage.value = 'Error de conexión. Verifica tu internet.'
|
errorMessage.value = 'Error de conexión. Verifica tu internet o el estado del servidor.'
|
||||||
} else if (error.response.status === 401) {
|
} else if (error.response.status === 401) {
|
||||||
errorMessage.value = 'Correo o contraseña incorrectos.'
|
errorMessage.value = 'Correo o contraseña incorrectos.'
|
||||||
} else {
|
} else {
|
||||||
errorMessage.value = error.response?.data?.detail || 'Error en el servidor.'
|
errorMessage.value = `Error (${error.response.status}): ${error.response?.data?.detail || 'Error en el servidor.'}`
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
@ -52,22 +53,21 @@ const handleLogin = async () => {
|
|||||||
const handleGoogleLogin = async () => {
|
const handleGoogleLogin = async () => {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
console.log('Iniciando Google Login...')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { token } = await signInWithGoogle()
|
const { token } = await signInWithGoogle()
|
||||||
const response = await authService.googleLogin(token)
|
console.log('Firebase token obtenido:', token ? 'SI' : 'NO (Redirecting...)')
|
||||||
|
|
||||||
authStore.login(response.access_token, response.role, response.full_name)
|
|
||||||
|
|
||||||
const role = response.role.toUpperCase()
|
|
||||||
if (role === 'ADMIN') router.push('/admin')
|
|
||||||
else if (role === 'DRIVER') router.push('/driver')
|
|
||||||
else if (role === 'PROMOTER') router.push('/promoter')
|
|
||||||
else router.push('/map')
|
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
const response = await authService.googleLogin(token)
|
||||||
|
console.log('Backend Google login exitoso:', response)
|
||||||
|
authStore.login(response.access_token, response.role, response.full_name)
|
||||||
|
router.push('/map')
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorMessage.value = 'Error al iniciar sesión con Google.'
|
console.error('Error Google Login:', error)
|
||||||
console.error(error)
|
errorMessage.value = `Error con Google: ${error.message || 'Error desconocido'}`
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,23 +22,50 @@ const showPassword = ref(false)
|
|||||||
const handleRegister = async () => {
|
const handleRegister = async () => {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
console.log('Intentando registrar usuario...')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await authService.registerPassenger({
|
const cleanEmail = email.value.trim().toLowerCase()
|
||||||
|
const cleanPass = password.value
|
||||||
|
|
||||||
|
const regResponse = await authService.registerPassenger({
|
||||||
full_name: fullName.value.trim(),
|
full_name: fullName.value.trim(),
|
||||||
email: email.value.trim().toLowerCase(),
|
email: cleanEmail,
|
||||||
password: password.value
|
password: cleanPass
|
||||||
})
|
})
|
||||||
|
console.log('Registro exitoso en backend:', regResponse)
|
||||||
|
|
||||||
analyticsService.logEvent({
|
analyticsService.logEvent({
|
||||||
event_name: 'sign_up',
|
event_name: 'sign_up',
|
||||||
properties: { method: 'email' }
|
properties: { method: 'email' }
|
||||||
})
|
})
|
||||||
|
|
||||||
successMessage.value = '¡Cuenta creada! Ahora puedes iniciar sesión.'
|
// Iniciar sesión automáticamente después del registro
|
||||||
setTimeout(() => { emit('success') }, 2000)
|
console.log('Iniciando sesión automática...')
|
||||||
|
const response = await authService.login({
|
||||||
|
email: cleanEmail,
|
||||||
|
password: cleanPass
|
||||||
|
})
|
||||||
|
console.log('Login automático exitoso:', response)
|
||||||
|
|
||||||
|
authStore.login(response.access_token, response.role, response.full_name)
|
||||||
|
|
||||||
|
successMessage.value = '¡Cuenta creada con éxito!'
|
||||||
|
|
||||||
|
// Redirigir casi de inmediato
|
||||||
|
setTimeout(() => {
|
||||||
|
router.push('/map')
|
||||||
|
}, 1000)
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorMessage.value = error.response?.data?.detail || 'Error al crear la cuenta.'
|
console.error('Error detallado de registro:', error)
|
||||||
|
if (error.response) {
|
||||||
|
errorMessage.value = `Error del servidor (${error.response.status}): ${error.response.data?.detail || 'Error desconocido'}`
|
||||||
|
} else if (error.request) {
|
||||||
|
errorMessage.value = 'No se recibió respuesta del servidor. ¿Backend caído?'
|
||||||
|
} else {
|
||||||
|
errorMessage.value = `Error: ${error.message}`
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
@ -47,27 +74,28 @@ const handleRegister = async () => {
|
|||||||
const handleGoogleRegister = async () => {
|
const handleGoogleRegister = async () => {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
|
console.log('Iniciando Google Register...')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { token } = await signInWithGoogle()
|
const { token } = await signInWithGoogle()
|
||||||
const response = await authService.googleLogin(token)
|
console.log('Firebase token obtenido:', token ? 'SI' : 'NO (Redirecting...)')
|
||||||
|
|
||||||
analyticsService.logEvent({
|
if (token) {
|
||||||
event_name: 'sign_up',
|
const response = await authService.googleLogin(token)
|
||||||
properties: { method: 'google' }
|
console.log('Backend Google login exitoso:', response)
|
||||||
})
|
|
||||||
|
|
||||||
authStore.login(response.access_token, response.role, response.full_name)
|
analyticsService.logEvent({
|
||||||
|
event_name: 'sign_up',
|
||||||
|
properties: { method: 'google' }
|
||||||
|
})
|
||||||
|
|
||||||
const role = response.role.toUpperCase()
|
authStore.login(response.access_token, response.role, response.full_name)
|
||||||
if (role === 'ADMIN') router.push('/admin')
|
router.push('/map')
|
||||||
else if (role === 'DRIVER') router.push('/driver')
|
}
|
||||||
else if (role === 'PROMOTER') router.push('/promoter')
|
|
||||||
else router.push('/map')
|
|
||||||
|
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorMessage.value = 'Error al registrarse con Google. Intenta de nuevo.'
|
console.error('Error Google Register:', error)
|
||||||
console.error(error)
|
errorMessage.value = `Error con Google: ${error.message || 'Intenta de nuevo'}`
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,17 +31,20 @@ const isMobile = () => {
|
|||||||
* - Uses signInWithRedirect on mobile (avoids popup blocking on mobile browsers)
|
* - Uses signInWithRedirect on mobile (avoids popup blocking on mobile browsers)
|
||||||
*/
|
*/
|
||||||
export const signInWithGoogle = async (): Promise<{ user: any; token: string }> => {
|
export const signInWithGoogle = async (): Promise<{ user: any; token: string }> => {
|
||||||
if (isMobile()) {
|
try {
|
||||||
// On mobile, redirect flow is more reliable
|
if (isMobile()) {
|
||||||
await signInWithRedirect(auth, googleProvider);
|
console.log("DEBUG: Intentando signInWithRedirect...");
|
||||||
// The page will reload; the result is handled by getGoogleRedirectResult() on app load
|
await signInWithRedirect(auth, googleProvider);
|
||||||
// We return a never-resolving promise to keep the UI in loading state
|
return new Promise(() => { });
|
||||||
return new Promise(() => { });
|
} else {
|
||||||
} else {
|
console.log("DEBUG: Intentando signInWithPopup...");
|
||||||
// On desktop, use popup
|
const result = await signInWithPopup(auth, googleProvider);
|
||||||
const result = await signInWithPopup(auth, googleProvider);
|
const token = await result.user.getIdToken();
|
||||||
const token = await result.user.getIdToken();
|
return { user: result.user, token };
|
||||||
return { user: result.user, token };
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error("DEBUG: Error al iniciar Google:", error);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,8 +61,8 @@ export const getGoogleRedirectResult = async (): Promise<{ user: any; token: str
|
|||||||
return { user: result.user, token };
|
return { user: result.user, token };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error("Error getting redirect result:", error);
|
console.error("DEBUG: Error en getRedirectResult:", error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -293,16 +293,21 @@ function handleBack() {
|
|||||||
async function createRoute() {
|
async function createRoute() {
|
||||||
const name = prompt("Nombre de la nueva ruta:")
|
const name = prompt("Nombre de la nueva ruta:")
|
||||||
if (!name) return
|
if (!name) return
|
||||||
const route = await routesService.createRoute({
|
try {
|
||||||
name,
|
const route = await routesService.createRoute({
|
||||||
origin_city: 'David',
|
name,
|
||||||
destination_city: 'Boquete',
|
origin_city: 'David',
|
||||||
status: 'active',
|
destination_city: 'Boquete',
|
||||||
color: '#FEE715',
|
status: 'active',
|
||||||
direction: 'outbound'
|
color: '#FEE715',
|
||||||
})
|
direction: 'outbound'
|
||||||
routes.value = await routesService.getAllRoutes()
|
})
|
||||||
selectRoute(route)
|
routes.value = await routesService.getAllRoutes()
|
||||||
|
selectRoute(route)
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('Error creating route:', err)
|
||||||
|
alert('No se pudo crear la ruta: ' + (err.response?.data?.detail || err.message))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function selectRoute(route: Route) {
|
async function selectRoute(route: Route) {
|
||||||
@ -312,14 +317,19 @@ async function selectRoute(route: Route) {
|
|||||||
|
|
||||||
async function updateRouteDetails() {
|
async function updateRouteDetails() {
|
||||||
if (!selectedRoute.value) return
|
if (!selectedRoute.value) return
|
||||||
await routesService.updateRoute(selectedRoute.value.id, {
|
try {
|
||||||
name: selectedRoute.value.name,
|
await routesService.updateRoute(selectedRoute.value.id, {
|
||||||
origin_city: selectedRoute.value.origin_city,
|
name: selectedRoute.value.name,
|
||||||
destination_city: selectedRoute.value.destination_city,
|
origin_city: selectedRoute.value.origin_city,
|
||||||
average_speed_kmh: selectedRoute.value.average_speed_kmh,
|
destination_city: selectedRoute.value.destination_city,
|
||||||
status: selectedRoute.value.status,
|
average_speed_kmh: selectedRoute.value.average_speed_kmh,
|
||||||
color: selectedRoute.value.color
|
status: selectedRoute.value.status,
|
||||||
})
|
color: selectedRoute.value.color
|
||||||
|
})
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('Error updating route:', err)
|
||||||
|
// Opcional: mostrar notificación sutil en lugar de alert recurrente
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addStop() {
|
async function addStop() {
|
||||||
@ -331,11 +341,16 @@ async function addStop() {
|
|||||||
|
|
||||||
async function addExistingStop(stopId: string) {
|
async function addExistingStop(stopId: string) {
|
||||||
if (!selectedRoute.value) return
|
if (!selectedRoute.value) return
|
||||||
await routesService.addStopToRoute(selectedRoute.value.id, {
|
try {
|
||||||
stop_id: stopId,
|
await routesService.addStopToRoute(selectedRoute.value.id, {
|
||||||
stop_order: routeStops.value.length + 1
|
stop_id: stopId,
|
||||||
})
|
stop_order: routeStops.value.length + 1
|
||||||
routeStops.value = await routesService.getRouteStops(selectedRoute.value.id)
|
})
|
||||||
|
routeStops.value = await routesService.getRouteStops(selectedRoute.value.id)
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('Error adding stop:', err)
|
||||||
|
alert('Error al añadir parada: ' + (err.response?.data?.detail || err.message))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateStop(stop: BusStop) {
|
async function updateStop(stop: BusStop) {
|
||||||
@ -364,9 +379,14 @@ async function removeStop(stop: BusStop) {
|
|||||||
async function deleteRoute() {
|
async function deleteRoute() {
|
||||||
if (!selectedRoute.value) return
|
if (!selectedRoute.value) return
|
||||||
if (confirm(`Estás SEGURO de que quieres eliminar la ruta ${selectedRoute.value.name}? Esta acción es permanente.`)) {
|
if (confirm(`Estás SEGURO de que quieres eliminar la ruta ${selectedRoute.value.name}? Esta acción es permanente.`)) {
|
||||||
await routesService.deleteRoute(selectedRoute.value.id)
|
try {
|
||||||
selectedRoute.value = null
|
await routesService.deleteRoute(selectedRoute.value.id)
|
||||||
routes.value = await routesService.getAllRoutes()
|
selectedRoute.value = null
|
||||||
|
routes.value = await routesService.getAllRoutes()
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error('Error deleting route:', err)
|
||||||
|
alert('No se pudo eliminar la ruta: ' + (err.response?.data?.detail || err.message))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,9 +26,8 @@ onMounted(async () => {
|
|||||||
else if (role === 'PROMOTER') router.push('/promoter')
|
else if (role === 'PROMOTER') router.push('/promoter')
|
||||||
else router.push('/map')
|
else router.push('/map')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e: any) {
|
||||||
// No redirect result pending, or error — ignore silently
|
console.error('Google redirect result error:', e)
|
||||||
console.warn('Google redirect result:', e)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@ -42,7 +41,7 @@ onMounted(async () => {
|
|||||||
<!-- Botón volver al mapa -->
|
<!-- Botón volver al mapa -->
|
||||||
<button class="back-to-map" @click="router.push('/map')">
|
<button class="back-to-map" @click="router.push('/map')">
|
||||||
<span class="material-icons">arrow_back</span>
|
<span class="material-icons">arrow_back</span>
|
||||||
Volver al mapa
|
Volver
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Branding -->
|
<!-- Branding -->
|
||||||
|
|||||||
@ -28,10 +28,14 @@ import { ref, onMounted } from 'vue'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useRouteStore } from '@/stores/route'
|
import { useRouteStore } from '@/stores/route'
|
||||||
import { useBusStopStore } from '@/stores/busStop'
|
import { useBusStopStore } from '@/stores/busStop'
|
||||||
|
import { useAuthStore } from '@/stores/auth'
|
||||||
|
import { authService } from '@/services/authService'
|
||||||
|
import { getGoogleRedirectResult } from '@/firebaseConfig'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const routeStore = useRouteStore()
|
const routeStore = useRouteStore()
|
||||||
const busStopStore = useBusStopStore()
|
const busStopStore = useBusStopStore()
|
||||||
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
const logoVisible = ref(false)
|
const logoVisible = ref(false)
|
||||||
const showLoading = ref(false)
|
const showLoading = ref(false)
|
||||||
@ -79,7 +83,23 @@ function navigate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function performInitializationTasks() {
|
async function performInitializationTasks() {
|
||||||
// Task 1: Check connection and load routes
|
// Task 1: Check for Google Redirect Result (Mobile Login)
|
||||||
|
statusMessage.value = 'Verificando sesión...'
|
||||||
|
try {
|
||||||
|
const googleResult = await getGoogleRedirectResult()
|
||||||
|
if (googleResult) {
|
||||||
|
statusMessage.value = 'Iniciando sesión con Google...'
|
||||||
|
const response = await authService.googleLogin(googleResult.token)
|
||||||
|
authStore.login(response.access_token, response.role, response.full_name)
|
||||||
|
statusMessage.value = `¡Bienvenido ${response.full_name}!`
|
||||||
|
// Wait a bit to show the welcome message
|
||||||
|
await new Promise(r => setTimeout(r, 800))
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Google Redirect handling failed:', error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Task 2: Check connection and load routes
|
||||||
statusMessage.value = 'Cargando datos de rutas...'
|
statusMessage.value = 'Cargando datos de rutas...'
|
||||||
try {
|
try {
|
||||||
await routeStore.loadRoutes()
|
await routeStore.loadRoutes()
|
||||||
@ -87,7 +107,7 @@ async function performInitializationTasks() {
|
|||||||
console.error('Error loading routes:', error)
|
console.error('Error loading routes:', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task 2: Load bus stops
|
// Task 3: Load bus stops
|
||||||
statusMessage.value = 'Cargando paradas...'
|
statusMessage.value = 'Cargando paradas...'
|
||||||
try {
|
try {
|
||||||
await busStopStore.loadBusStops()
|
await busStopStore.loadBusStops()
|
||||||
@ -95,7 +115,7 @@ async function performInitializationTasks() {
|
|||||||
console.error('Error loading bus stops:', error)
|
console.error('Error loading bus stops:', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task 3: Prepared
|
// Task 4: Prepared
|
||||||
statusMessage.value = 'Listo para usar'
|
statusMessage.value = 'Listo para usar'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user