Skip to content

Commit

Permalink
use webview fetch instead as tauri-apps/api/http only handles utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
garbidge authored and franciscoBSalgueiro committed Oct 23, 2023
1 parent c30726c commit febf9ee
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/utils/lichess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,9 @@ export async function downloadLichess(
}

export async function getLichessGame(gameId: string): Promise<string> {
return (
await fetch<string>(`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();
}

0 comments on commit febf9ee

Please sign in to comment.