Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 18x 7x 7x 7x 7x 7x | import { useQuery } from "react-query";
function useLatestActiveDevicesMetric(snapId?: string) {
return useQuery({
queryKey: ["latestActiveDevicesMetric", snapId],
queryFn: async () => {
const response = await fetch(`/${snapId}/metrics/active-latest-devices`);
Iif (!response.ok) {
if (response.status === 404) {
return null;
} else {
throw new Error("Unable to fetch latest active device information");
}
}
const data = await response.json();
const activeDevices = data.latest_active_devices;
return String(activeDevices).replace(/(.)(?=(\d{3})+$)/g, "$1,");
},
retry: 0,
refetchOnWindowFocus: false,
});
}
export default useLatestActiveDevicesMetric;
|