From b74e20ec22c15b99384865b8d8959f77693f20db Mon Sep 17 00:00:00 2001 From: kdh8219 <65698239+kdh8219@users.noreply.github.com> Date: Sat, 29 Apr 2023 00:39:54 +0900 Subject: [PATCH] fix mojang-api JSON.pharse --- src/wrapper/mojang-api.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wrapper/mojang-api.ts b/src/wrapper/mojang-api.ts index d0e1dce..492e7aa 100644 --- a/src/wrapper/mojang-api.ts +++ b/src/wrapper/mojang-api.ts @@ -12,7 +12,7 @@ class MojangAPI { const request = await axios.get( `https://api.mojang.com/user/profile/${minecraft_uuid}` ); - id = JSON.parse(request.data).name; + id = request.data.name; if (!id) throw new Error("Failed to get minecraft id from api"); @@ -23,10 +23,10 @@ class MojangAPI { let uuid = this.cached.get_by_second(minecraft_id); if (uuid) return uuid; - const request = await axios.get( + const response = await axios.get( `https://api.mojang.com/users/profiles/minecraft/${minecraft_id}` ); - uuid = JSON.parse(request.data).id; + uuid = response.data.id; if (!uuid) throw new Error("Failed to get minecraft id from api"); this.cached.remove_by_first(uuid);