Start of dynamic ethic fetching
This commit is contained in:
parent
84301ecd0a
commit
74c6b6f688
2 changed files with 11 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
import { writable, type Writable } from "svelte/store";
|
import { writable, type Writable } from "svelte/store";
|
||||||
import type { ChellarisInfo } from '../types/chellaris';
|
import type { ChellarisInfo } from '../types/chellaris';
|
||||||
|
|
||||||
const ChellarisDataStore: Writable<ChellarisInfo> = writable();
|
const ChellarisDataStore: Writable<ChellarisInfo> = writable({
|
||||||
|
games: new Map(),
|
||||||
|
ethics: [],
|
||||||
|
portraits: []
|
||||||
|
});
|
||||||
|
|
||||||
export default ChellarisDataStore;
|
export default ChellarisDataStore;
|
|
@ -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);
|
ChellarisDataStore.set(chellarisData);
|
||||||
|
|
||||||
// Local Storage Code
|
// Local Storage Code
|
||||||
|
|
||||||
if (typeof localStorage !== 'undefined') {
|
if (typeof localStorage !== 'undefined') {
|
||||||
// Tab Selection
|
// Tab Selection
|
||||||
store = localStorage.getItem('graphsTab');
|
store = localStorage.getItem('graphsTab');
|
||||||
|
|
Reference in a new issue