feat: update routes with color and direction, improve admin routes view, and update firebase config/auth
This commit is contained in:
@ -28,10 +28,14 @@ import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRouteStore } from '@/stores/route'
|
||||
import { useBusStopStore } from '@/stores/busStop'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { authService } from '@/services/authService'
|
||||
import { getGoogleRedirectResult } from '@/firebaseConfig'
|
||||
|
||||
const router = useRouter()
|
||||
const routeStore = useRouteStore()
|
||||
const busStopStore = useBusStopStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const logoVisible = ref(false)
|
||||
const showLoading = ref(false)
|
||||
@ -79,7 +83,23 @@ function navigate() {
|
||||
}
|
||||
|
||||
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...'
|
||||
try {
|
||||
await routeStore.loadRoutes()
|
||||
@ -87,7 +107,7 @@ async function performInitializationTasks() {
|
||||
console.error('Error loading routes:', error)
|
||||
}
|
||||
|
||||
// Task 2: Load bus stops
|
||||
// Task 3: Load bus stops
|
||||
statusMessage.value = 'Cargando paradas...'
|
||||
try {
|
||||
await busStopStore.loadBusStops()
|
||||
@ -95,7 +115,7 @@ async function performInitializationTasks() {
|
||||
console.error('Error loading bus stops:', error)
|
||||
}
|
||||
|
||||
// Task 3: Prepared
|
||||
// Task 4: Prepared
|
||||
statusMessage.value = 'Listo para usar'
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user