Differenitiating between hires and lores iamges
This commit is contained in:
parent
94e9b8f0ba
commit
a3d43a7742
2 changed files with 9 additions and 7 deletions
|
@ -76,6 +76,7 @@ export type Species = {
|
|||
}
|
||||
|
||||
export type Portrait = {
|
||||
imageLink: string,
|
||||
hires: string,
|
||||
lores: string,
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
Reference in a new issue