From febf9eea121143f2c5499c363f2cc271675940ac Mon Sep 17 00:00:00 2001 From: sleeplessghost Date: Mon, 23 Oct 2023 04:36:02 +1030 Subject: [PATCH] use webview fetch instead as tauri-apps/api/http only handles utf-8 --- src/utils/lichess.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/lichess.tsx b/src/utils/lichess.tsx index 1d5eab7b..d1d55b7d 100644 --- a/src/utils/lichess.tsx +++ b/src/utils/lichess.tsx @@ -234,10 +234,9 @@ export async function downloadLichess( } export async function getLichessGame(gameId: string): Promise { - return ( - await fetch(`https://lichess.org/game/export/${gameId}`, { - method: "GET", - responseType: ResponseType.Text, - }) - ).data; + const response = await window.fetch(`https://lichess.org/game/export/${gameId}`); + if (!response.ok) { + throw new Error(`Failed to load lichess game ${gameId} - ${response.statusText}`); + } + return await response.text(); }