log rate limit left
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 47s
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m11s

This commit is contained in:
Lee 2024-10-19 12:48:57 +01:00
parent 79bdb801ff
commit e0aeec5d5a

View File

@ -39,7 +39,11 @@ export default class Service {
*/
public async fetch<T>(url: string): Promise<T | undefined> {
try {
return await ky.get<T>(this.buildRequestUrl(!isServer(), url)).json();
const response = await ky.get<T>(this.buildRequestUrl(!isServer(), url));
if (response.headers.has("X-RateLimit-Remaining")) {
this.log(`Rate limit remaining: ${response.headers.get("X-RateLimit-Remaining")}`);
}
return response.json();
} catch (error) {
return undefined;
}