Start of dynamic ethic fetching

This commit is contained in:
Neshura 2023-08-15 22:51:41 +02:00
parent 84301ecd0a
commit 74c6b6f688
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,10 @@
import { writable, type Writable } from "svelte/store";
import type { ChellarisInfo } from '../types/chellaris';
const ChellarisDataStore: Writable<ChellarisInfo> = writable();
const ChellarisDataStore: Writable<ChellarisInfo> = writable({
games: new Map(),
ethics: [],
portraits: []
});
export default ChellarisDataStore;

View file

@ -54,11 +54,15 @@ export const load: LayoutLoad = async () => {
}
});
console.log(chellarisData); //DEBUG
const ethics: {id: number, name: string, fanatic: boolean}[] = await (await fetch(apiBaseUrl + '/ethics')).json();
ethics.forEach(ethic => {
console.log(ethic.name);
});
ChellarisDataStore.set(chellarisData);
// Local Storage Code
if (typeof localStorage !== 'undefined') {
// Tab Selection
store = localStorage.getItem('graphsTab');