mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
fix: fetch import
This commit is contained in:
1 parent
d4f676091d
commit
859efd1f02
1 file changed
+3
-2
@@ -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 {
|
||||||
|
|||||||
Reference in new issue
Block a user