mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
12 lines
332 B
TypeScript
12 lines
332 B
TypeScript
|
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);
|
||
|
}
|