AEB-71: Added 3D navigation in monitoring zones
This commit is contained in:
@@ -4,6 +4,7 @@ import React, { useState, useEffect } from 'react'
|
||||
import ObjectGallery from '../../../components/objects/ObjectGallery'
|
||||
import { ObjectData } from '../../../components/objects/ObjectCard'
|
||||
import Sidebar from '../../../components/ui/Sidebar'
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
// Универсальная функция для преобразования объекта из бэкенда в ObjectData
|
||||
const transformRawToObjectData = (raw: any): ObjectData => {
|
||||
@@ -27,6 +28,7 @@ const ObjectsPage: React.FC = () => {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [selectedObjectId, setSelectedObjectId] = useState<string | null>(null)
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
@@ -41,7 +43,15 @@ const ObjectsPage: React.FC = () => {
|
||||
console.log('[ObjectsPage] GET /api/get-objects', { status: res.status, payload })
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(typeof payload === 'string' ? payload : (payload?.error || 'Не удалось получить данные объектов'))
|
||||
const errorMessage = typeof payload === 'string' ? payload : (payload?.error || 'Не удалось получить данные объектов')
|
||||
|
||||
if (errorMessage.includes('Authentication required') || res.status === 401) {
|
||||
console.log('[ObjectsPage] Authentication required, redirecting to login')
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
|
||||
throw new Error(errorMessage)
|
||||
}
|
||||
|
||||
const data = (payload?.data ?? payload) as any
|
||||
@@ -66,7 +76,7 @@ const ObjectsPage: React.FC = () => {
|
||||
}
|
||||
|
||||
loadData()
|
||||
}, [])
|
||||
}, [router])
|
||||
|
||||
const handleObjectSelect = (objectId: string) => {
|
||||
console.log('Object selected:', objectId)
|
||||
|
||||
Reference in New Issue
Block a user