Auto Fetch First Game Index

This commit is contained in:
Neshura 2023-09-12 19:01:58 +02:00
parent e56c051267
commit a09f654c93
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -3,18 +3,28 @@
import { LeanChellarisDataStore } from '$lib/stores/ChellarisData';
import Header from './Header.svelte';
import './styles.css';
import AdminSelectedGameStore from '$lib/stores/admin-page/GameStore';
$: {
fetch(apiBaseUrl + '/v3/ethics').then((res) => {
res.json().then((data) => {
$LeanChellarisDataStore.ethics = data.ethics;
})
});
});
fetch(apiBaseUrl + '/v3/phenotypes').then((res) => {
res.json().then((data) => {
$LeanChellarisDataStore.phenotypes = data.phenotypes;
})
});
});
fetch(apiBaseUrl + '/v3/games').then((res) => {
res.json().then((data) => {
if ($AdminSelectedGameStore == 1) {
$AdminSelectedGameStore = data[0].id;
}
});
});
}
</script>