1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
Files
checktheroads-hyperglass/hyperglass/ui/hooks/useASNDetail.ts

12 lines
332 B
TypeScript
Raw Normal View History

import { useQuery } from 'react-query';
import type { TASNDetails } from '~/types';
async function query(asn: string): Promise<TASNDetails> {
const res = await fetch(`https://api.bgpview.io/asn/${asn}`, { mode: 'cors' });
return await res.json();
}
export function useASNDetail(asn: string) {
return useQuery(asn, query);
}