fix: fetch import

This commit is contained in:
TresAbhi committed 2023-04-27 00:24:21 +00:00
1 parent d4f676091d
commit 859efd1f02
1 file changed
+3 -2
+3 -2
View File
@@ -1,4 +1,5 @@
import { CacheType, ChatInputCommandInteraction } from 'discord.js'; import { CacheType, ChatInputCommandInteraction } from 'discord.js';
import fetch from 'node-fetch';
import { WargamingResponse } from '../types/wargamingResponse.js'; import { WargamingResponse } from '../types/wargamingResponse.js';
import wargamingError from './wargamingError.js'; import wargamingError from './wargamingError.js';
@@ -8,8 +9,8 @@ export default function getWargamingResponse<Data extends object>(
callback: (data: Data) => void, callback: (data: Data) => void,
) { ) {
fetch(url) fetch(url)
.then((response) => response.json()) .then((response) => response.json() as Promise<WargamingResponse<Data>>)
.then((response: WargamingResponse<Data>) => { .then((response) => {
if (response.status === 'ok') { if (response.status === 'ok') {
callback(response.data); callback(response.data);
} else { } else {