feat: cleaned up directories

This commit is contained in:
TresAbhi committed 2023-05-13 22:01:58 +00:00
1 parent 473ebfa46c
commit 613527e78f
41 files changed
+116 -832

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import fetch from 'node-fetch';
import { WargamingResponse } from '../../types/wargamingResponse.js';
export default async function getWargamingResponse<Data extends object>(
url: string,
) {
let parsed: WargamingResponse<Data>;
const response = await fetch(url);
parsed = (await response.json()) as WargamingResponse<Data>;
if (parsed.status === 'ok') {
return parsed.data;
} else {
console.error(`Wargaming response status ${parsed.status}`);
return null;
}
}