(method: string = "POST",
url: string,
header: Record<string, any>,
body: BodyInit | null | undefined)
| 74 | } |
| 75 | |
| 76 | export async function dnsAPI(method: string = "POST", |
| 77 | url: string, |
| 78 | header: Record<string, any>, |
| 79 | body: BodyInit | null | undefined) { |
| 80 | try { |
| 81 | console.log(method, url); |
| 82 | const response = await fetch(url, |
| 83 | { |
| 84 | method: method, |
| 85 | headers: header, |
| 86 | body: body |
| 87 | } |
| 88 | ); |
| 89 | const data: Record<string, any> = await response.json(); |
| 90 | // console.log('Result:', data); |
| 91 | return data; |
| 92 | } catch (error) { |
| 93 | console.error(error); |
| 94 | return {}; |
| 95 | } |
| 96 | } |