[chore] Update npm packages and fix errors/run migrations

This commit is contained in:
2022-01-03 20:12:22 +01:00
parent 9de5aa16c9
commit 729138cffb
15 changed files with 186 additions and 182 deletions

View File

@@ -52,8 +52,8 @@
*/
const urlFiltersParams = new URLSearchParams()
let filtered: boolean
let filterCountry = $page.query.get('country') || defaultCountry
let filterSort = $page.query.get('sort') || defaultSort
let filterCountry = $page.url.searchParams.get('country') || defaultCountry
let filterSort = $page.url.searchParams.get('sort') || defaultSort
let countryFlagId: string
$: filtered = filterCountry !== defaultCountry || filterSort !== defaultSort
$: latestPhoto = photos[0]
@@ -93,7 +93,7 @@
urlFiltersParams.set('country', filterCountry)
urlFiltersParams.set('sort', filterSort)
let path = `${$page.path}?${urlFiltersParams.toString()}`
let path = `${$page.url.pathname}?${urlFiltersParams.toString()}`
goto(path, { replaceState: true, keepfocus: true, noscroll: true })
}
@@ -486,7 +486,7 @@
{:else if !filteredCountryExists}
<div class="photos__message">
<p>
<strong>{$page.query.get('country').replace(/(^|\s)\S/g, letter => letter.toUpperCase())}</strong> is not available… yet 👀
<strong>{$page.url.searchParams.get('country').replace(/(^|\s)\S/g, letter => letter.toUpperCase())}</strong> is not available… yet 👀
</p>
</div>
{/if}
@@ -509,11 +509,13 @@
const defaultCountry = String(import.meta.env.VITE_FILTERS_DEFAULT_COUNTRY)
const defaultSort = String(import.meta.env.VITE_FILTERS_DEFAULT_SORT)
/** @type {import('@sveltejs/kit').Load} */
export async function load ({ url, params, fetch, session, stuff }) {
console.log(url)
export async function load ({ page, fetch, session, stuff }) {
// Query parameters
const queryCountry = page.query.get('country') || defaultCountry
const querySort = page.query.get('sort') || defaultSort
const queryCountry = url.searchParams.get('country') || defaultCountry
const querySort = url.searchParams.get('sort') || defaultSort
const res = await fetchAPI(`
query {