better error for failied league loading

This commit is contained in:
Alexander Drozdov
2020-04-21 14:18:00 +03:00
parent ffc1105050
commit 5eb808ef63
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -18,7 +18,8 @@
<span class="text-red-400">Failed to load leagues</span>
<button class="btn ml-2" @click="retry">Retry</button>
</div>
<div>Error: {{ leaguesService.loadingError }}</div>
<pre class="text-gray-500 whitespace-normal">Error: {{ leaguesService.loadingError }}</pre>
<div class="font-fontin-bold">Verify that the realm is not under maintenance and pathofexile.com is loading.</div>
</div>
</div>
</div>
+1
View File
@@ -30,6 +30,7 @@ export class LeaguesService {
try {
const response = await fetch('https://api.pathofexile.com/leagues?type=main&realm=pc&compact=1')
if (!response.ok) throw new Error(JSON.stringify(Object.fromEntries(response.headers)))
const leagues: Array<{ id: string }> = await response.json()
const tradeLeagues = leagues.filter(league => !league.id.startsWith('SSF '))