mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
continue typescript & chakra v1 migrations [skip ci]
This commit is contained in:
11
hyperglass/ui/hooks/useASNDetail.ts
Normal file
11
hyperglass/ui/hooks/useASNDetail.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user