[chore] Update npm packages and fix errors/run migrations
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user