Fix jwt-token

This commit is contained in:
2025-08-28 08:44:42 +02:00
parent af8a5c5ffe
commit 7898cfa7b4
2 changed files with 38 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import api from '../services/api';
import { format } from 'date-fns';
import {
@@ -12,6 +13,7 @@ import {
} from '@heroicons/react/24/outline';
const Devices = () => {
const navigate = useNavigate();
const [devices, setDevices] = useState([]);
const [loading, setLoading] = useState(true);
const [showAddModal, setShowAddModal] = useState(false);
@@ -82,9 +84,18 @@ const Devices = () => {
const handleViewOnMap = (device) => {
if (device.geo_lat && device.geo_lon) {
// Open Google Maps with the device location
const url = `https://www.google.com/maps?q=${device.geo_lat},${device.geo_lon}&z=15`;
window.open(url, '_blank');
// Navigate to map with device information
navigate('/map', {
state: {
focusDevice: {
id: device.id,
name: device.name || `Device ${device.id}`,
lat: device.geo_lat,
lon: device.geo_lon,
status: device.stats?.status || 'unknown'
}
}
});
} else {
alert('Device location coordinates are not available');
}