Fix jwt-token
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user