[chore] Update npm packages and fix errors/run migrations
This commit is contained in:
@@ -64,7 +64,7 @@
|
||||
|
||||
// Change URL to current photo slug
|
||||
$: if (browser && currentPhoto) {
|
||||
window.history.replaceState(null, '', $page.path.replace($page.params.photo, currentPhoto.slug))
|
||||
window.history.replaceState(null, '', $page.url.pathname.replace($page.params.photo, currentPhoto.slug))
|
||||
}
|
||||
|
||||
// Define previous URL
|
||||
@@ -407,11 +407,12 @@
|
||||
<script context="module" lang="ts">
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export async function load ({ page, fetch, session, stuff }) {
|
||||
/** @type {import('@sveltejs/kit').Load} */
|
||||
export async function load ({ url, params, fetch, session, stuff }) {
|
||||
// Get the first photo ID
|
||||
const firstPhoto = await fetchAPI(`
|
||||
query {
|
||||
photo: photo (search: "${page.params.photo}") {
|
||||
photo: photo (search: "${params.photo}") {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -423,7 +424,7 @@
|
||||
count: photo_aggregated (
|
||||
filter: {
|
||||
id: { _gt: ${firstPhotoId} },
|
||||
location: { slug: { _eq: "${page.params.location}" }},
|
||||
location: { slug: { _eq: "${params.location}" }},
|
||||
status: { _eq: "published" },
|
||||
},
|
||||
sort: "-id",
|
||||
@@ -441,7 +442,7 @@
|
||||
query {
|
||||
photos: photo (
|
||||
filter: {
|
||||
location: { slug: { _eq: "${page.params.location}" }}
|
||||
location: { slug: { _eq: "${params.location}" }}
|
||||
status: { _eq: "published" },
|
||||
},
|
||||
sort: "-date_created",
|
||||
@@ -459,7 +460,7 @@
|
||||
city
|
||||
}
|
||||
|
||||
location (filter: { slug: { _eq: "${page.params.location}" }}) {
|
||||
location (filter: { slug: { _eq: "${params.location}" }}) {
|
||||
name
|
||||
slug
|
||||
country {
|
||||
@@ -471,11 +472,11 @@
|
||||
`)
|
||||
|
||||
const { data } = res
|
||||
const location = stuff.locations.find((location: any) => location.slug === page.params.location)
|
||||
const location = stuff.locations.find((location: any) => location.slug === params.location)
|
||||
const totalPhotos = stuff.countTotalPhotosByLocation.find((total: any) => total.group.location === Number(location.id)).count.id
|
||||
|
||||
// Find photo's index
|
||||
const currentIndex = data.photos.findIndex((photo: any) => photo.slug === page.params.photo)
|
||||
const currentIndex = data.photos.findIndex((photo: any) => photo.slug === params.photo)
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
||||
@@ -356,8 +356,9 @@
|
||||
<script context="module" lang="ts">
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export async function load ({ page, fetch, session, stuff }) {
|
||||
const { location } = page.params
|
||||
/** @type {import('@sveltejs/kit').Load} */
|
||||
export async function load ({ url, params, fetch, session, stuff }) {
|
||||
const { location } = params
|
||||
|
||||
const res = await fetchAPI(`
|
||||
query {
|
||||
|
||||
Reference in New Issue
Block a user