Fix some stuff
All checks were successful
continuous-integration/drone/push Build is passing

- Error page now displaying (+ removed globe, more space between content and footer)
- Manipulate data if existing
This commit is contained in:
2020-04-14 22:23:01 +02:00
parent 2ef3ad838c
commit aeb4196918
4 changed files with 28 additions and 17 deletions

View File

@@ -83,20 +83,24 @@
/*
** Manipulate data
*/
// Replace each countrie's continent by the database
$countries.forEach(count => count.continent = $continents.find(cont => cont.id === count.continent.id))
if ($countries) {
// Replace each countrie's continent by the database
$countries.forEach(count => count.continent = $continents.find(cont => cont.id === count.continent.id))
// Push each country to its continent
$countries.forEach(country => {
const continent = $continents.find(cont => cont.id === country.continent.id)
continent.countries = []
if (!continent.countries.includes(country)) {
continent.countries.push(country)
}
})
// Push each country to its continent
$countries.forEach(country => {
const continent = $continents.find(cont => cont.id === country.continent.id)
continent.countries = []
if (!continent.countries.includes(country)) {
continent.countries.push(country)
}
})
}
// Replace each location's country by the database
$locations.forEach(loc => loc.country = $countries.find(cont => cont.id === loc.country.id))
if ($locations) {
$locations.forEach(loc => loc.country = $countries.find(cont => cont.id === loc.country.id))
}
onMount(async () => {