diff --git a/src/lib/types/stellaris.ts b/src/lib/types/stellaris.ts index d7b4585..d890832 100644 --- a/src/lib/types/stellaris.ts +++ b/src/lib/types/stellaris.ts @@ -76,6 +76,7 @@ export type Species = { } export type Portrait = { - imageLink: string, + hires: string, + lores: string, } diff --git a/src/routes/graphs/+layout.ts b/src/routes/graphs/+layout.ts index 7e6ad53..a4c4009 100644 --- a/src/routes/graphs/+layout.ts +++ b/src/routes/graphs/+layout.ts @@ -6,7 +6,7 @@ import { createChellarisInfo, type ChellarisGame, createChellarisGame, createChe import type { LayoutLoad } from "./$types"; import type { Ethic } from '../../lib/types/stellaris'; -export const load: LayoutLoad = async () => { +export const load: LayoutLoad = async ({ fetch }) => { let store: string | null; const apiBaseUrl = 'https://www.chellaris.net/api/v2'; const chellarisData = createChellarisInfo(); @@ -101,7 +101,8 @@ export const load: LayoutLoad = async () => { const portraits: { id: number, - href: string, + hires: string, + lores: string, group_id: number }[] = await (await fetch(apiBaseUrl + '/portraits')).json(); @@ -111,7 +112,7 @@ export const load: LayoutLoad = async () => { const portraitGroupData = chellarisData.species.get(portrait.group_id); if (typeof portraitGroupData !== "undefined") { - const newPortraitData = { imageLink: portrait.href }; + const newPortraitData = { hires: portrait.hires, lores: portrait.lores }; portraitGroupData.portraits.set(portrait.id, newPortraitData); } @@ -129,11 +130,11 @@ export const load: LayoutLoad = async () => { // Game Selection store = localStorage.getItem('gameSelection'); - let selectedGame = 0; - if (typeof store == 'string') { + let selectedGame = 1; + if (typeof store == 'string' && store != "\"\"") { selectedGame = JSON.parse(store); - SelectedGameStore.set(selectedGame); } + SelectedGameStore.set(selectedGame); // Game Groups Selection store = localStorage.getItem('gameGroupSelection');