refactor: get rid of page data types
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { LayoutServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { fetchSwell } from '$utils/functions/shopServer'
|
import { fetchSwell } from '$utils/functions/shopServer'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async () => {
|
export const load = async () => {
|
||||||
try {
|
try {
|
||||||
// Get content from API
|
// Get content from API
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
@@ -76,4 +75,4 @@ export const load = (async () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies LayoutServerLoad
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { setContext } from 'svelte'
|
import { setContext } from 'svelte'
|
||||||
import { cartNotifications } from '$utils/stores/shop'
|
import { cartNotifications } from '$utils/stores/shop'
|
||||||
// Components
|
// Components
|
||||||
import Cart from '$components/organisms/Cart.svelte'
|
import Cart from '$components/organisms/Cart.svelte'
|
||||||
import NotificationCart from '$components/molecules/NotificationCart.svelte'
|
import NotificationCart from '$components/molecules/NotificationCart.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
const { shop, locations, posters, shopProducts, settings } = data
|
const { shop, locations, posters, shopProducts, settings } = data
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { getRandomItem } from 'utils/array'
|
import { getRandomItem } from 'utils/array'
|
||||||
import { fetchSwell } from '$utils/functions/shopServer'
|
import { fetchSwell } from '$utils/functions/shopServer'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Get content from API
|
// Get content from API
|
||||||
const data = await fetchAPI(`query {
|
const data = await fetchAPI(`query {
|
||||||
@@ -54,4 +53,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { getContext } from 'svelte'
|
import { getContext } from 'svelte'
|
||||||
import { getAssetUrlKey } from '$utils/api'
|
import { getAssetUrlKey } from '$utils/api'
|
||||||
import { shopCurrentProductSlug } from '$utils/stores/shop'
|
import { shopCurrentProductSlug } from '$utils/stores/shop'
|
||||||
@@ -10,7 +9,7 @@
|
|||||||
import ShopHeader from '$components/organisms/ShopBanner.svelte'
|
import ShopHeader from '$components/organisms/ShopBanner.svelte'
|
||||||
import PosterLayout from '$components/layouts/PosterLayout.svelte'
|
import PosterLayout from '$components/layouts/PosterLayout.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
const { product, shopProduct }: { product: any, shopProduct: any } = data
|
const { product, shopProduct }: { product: any, shopProduct: any } = data
|
||||||
const { posters, settings }: any = getContext('shop')
|
const { posters, settings }: any = getContext('shop')
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { fetchSwell } from '$utils/functions/shopServer'
|
import { fetchSwell } from '$utils/functions/shopServer'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ params, setHeaders }) => {
|
export const load = async ({ params, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Get content from API
|
// Get content from API
|
||||||
const data = await fetchAPI(`query {
|
const data = await fetchAPI(`query {
|
||||||
@@ -51,4 +50,4 @@ export const load = (async ({ params, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(404)
|
throw error(404)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { getContext } from 'svelte'
|
import { getContext } from 'svelte'
|
||||||
import { getAssetUrlKey } from '$utils/api'
|
import { getAssetUrlKey } from '$utils/api'
|
||||||
import { shopCurrentProductSlug } from '$utils/stores/shop'
|
import { shopCurrentProductSlug } from '$utils/stores/shop'
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
import PostersGrid from '$components/organisms/PostersGrid.svelte'
|
import PostersGrid from '$components/organisms/PostersGrid.svelte'
|
||||||
import PosterLayout from '$components/layouts/PosterLayout.svelte'
|
import PosterLayout from '$components/layouts/PosterLayout.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
const { posters }: any = getContext('shop')
|
const { posters }: any = getContext('shop')
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { PUBLIC_LIST_AMOUNT } from '$env/static/public'
|
import { PUBLIC_LIST_AMOUNT } from '$env/static/public'
|
||||||
import { fetchAPI, photoFields } from '$utils/api'
|
import { fetchAPI, photoFields } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ params, setHeaders }) => {
|
export const load = async ({ params, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const { location: slug } = params
|
const { location: slug } = params
|
||||||
|
|
||||||
@@ -88,4 +87,4 @@ export const load = (async ({ params, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page, navigating } from '$app/stores'
|
import { page, navigating } from '$app/stores'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
||||||
import ShopModule from '$components/organisms/ShopModule.svelte'
|
import ShopModule from '$components/organisms/ShopModule.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data
|
let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data
|
||||||
$: ({ photos, totalPhotos } = data)
|
$: ({ photos, totalPhotos } = data)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ params, setHeaders }) => {
|
export const load = async ({ params, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Get the first photo ID
|
// Get the first photo ID
|
||||||
const firstPhoto = await fetchAPI(`query {
|
const firstPhoto = await fetchAPI(`query {
|
||||||
@@ -89,4 +88,4 @@ export const load = (async ({ params, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
import { page, navigating } from '$app/stores'
|
import { page, navigating } from '$app/stores'
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { onMount, tick } from 'svelte'
|
import { onMount, tick } from 'svelte'
|
||||||
import { fade, scale } from 'svelte/transition'
|
import { fade, scale } from 'svelte/transition'
|
||||||
import { quartOut } from 'svelte/easing'
|
import { quartOut } from 'svelte/easing'
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
import IconArrow from '$components/atoms/IconArrow.svelte'
|
import IconArrow from '$components/atoms/IconArrow.svelte'
|
||||||
import ButtonCircle from '$components/atoms/ButtonCircle.svelte'
|
import ButtonCircle from '$components/atoms/ButtonCircle.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
let { photos, currentIndex }: { photos: any[], currentIndex: number } = data
|
let { photos, currentIndex }: { photos: any[], currentIndex: number } = data
|
||||||
const { location, countPhotos, limit, offset }: { location: any, countPhotos: number, limit: number, offset: number } = data
|
const { location, countPhotos, limit, offset }: { location: any, countPhotos: number, limit: number, offset: number } = data
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { getRandomItems } from 'utils/array'
|
import { getRandomItems } from 'utils/array'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Get data and total of published photos
|
// Get data and total of published photos
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
@@ -102,4 +101,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
import { onMount, afterUpdate } from 'svelte'
|
import { onMount, afterUpdate } from 'svelte'
|
||||||
import { quartOut as quartOutSvelte } from 'svelte/easing'
|
import { quartOut as quartOutSvelte } from 'svelte/easing'
|
||||||
import { fade, fly } from 'svelte/transition'
|
import { fade, fly } from 'svelte/transition'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { animate, inView, stagger, timeline } from 'motion'
|
import { animate, inView, stagger, timeline } from 'motion'
|
||||||
import { mailtoClipboard } from '$utils/functions'
|
import { mailtoClipboard } from '$utils/functions'
|
||||||
import { getAssetUrlKey } from '$utils/api'
|
import { getAssetUrlKey } from '$utils/api'
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
import ProcessStep from '$components/molecules/ProcessStep.svelte'
|
import ProcessStep from '$components/molecules/ProcessStep.svelte'
|
||||||
import Banner from '$components/organisms/Banner.svelte'
|
import Banner from '$components/organisms/Banner.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
const { about, photos } = data
|
const { about, photos } = data
|
||||||
|
|
||||||
let scrollY: number, innerWidth: number, innerHeight: number
|
let scrollY: number, innerWidth: number, innerHeight: number
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { RequestHandler } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const POST = (async ({ request, setHeaders }) => {
|
export const POST = async ({ request, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const body = await request.text()
|
const body = await request.text()
|
||||||
|
|
||||||
@@ -22,4 +21,4 @@ export const POST = (async ({ request, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies RequestHandler
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
credits {
|
credits {
|
||||||
@@ -41,4 +40,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
import Heading from '$components/molecules/Heading.svelte'
|
import Heading from '$components/molecules/Heading.svelte'
|
||||||
import InteractiveGlobe from '$components/organisms/InteractiveGlobe.svelte'
|
import InteractiveGlobe from '$components/organisms/InteractiveGlobe.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
const { credit } = data
|
const { credit } = data
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { RequestHandler } from './$types'
|
|
||||||
import { fetchSwell } from '$utils/functions/shopServer'
|
import { fetchSwell } from '$utils/functions/shopServer'
|
||||||
import { fetchAPI, getAssetUrlKey } from '$utils/api'
|
import { fetchAPI, getAssetUrlKey } from '$utils/api'
|
||||||
|
|
||||||
@@ -12,7 +11,7 @@ const gCategories = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
export const GET = (async ({ url, setHeaders }) => {
|
export const GET = async ({ url, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const products = []
|
const products = []
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ export const GET = (async ({ url, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies RequestHandler
|
}
|
||||||
|
|
||||||
|
|
||||||
// Render sitemap
|
// Render sitemap
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { PUBLIC_FILTERS_DEFAULT_COUNTRY, PUBLIC_FILTERS_DEFAULT_SORT, PUBLIC_GRID_AMOUNT } from '$env/static/public'
|
import { PUBLIC_FILTERS_DEFAULT_COUNTRY, PUBLIC_FILTERS_DEFAULT_SORT, PUBLIC_GRID_AMOUNT } from '$env/static/public'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ url, setHeaders }) => {
|
export const load = async ({ url, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Query parameters
|
// Query parameters
|
||||||
const queryCountry = url.searchParams.get('country') || PUBLIC_FILTERS_DEFAULT_COUNTRY
|
const queryCountry = url.searchParams.get('country') || PUBLIC_FILTERS_DEFAULT_COUNTRY
|
||||||
@@ -85,4 +84,4 @@ export const load = (async ({ url, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page, navigating } from '$app/stores'
|
import { page, navigating } from '$app/stores'
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { getContext, onMount } from 'svelte'
|
import { getContext, onMount } from 'svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { quartOut as quartOutSvelte } from 'svelte/easing'
|
import { quartOut as quartOutSvelte } from 'svelte/easing'
|
||||||
@@ -32,7 +31,7 @@
|
|||||||
import ShopModule from '$components/organisms/ShopModule.svelte'
|
import ShopModule from '$components/organisms/ShopModule.svelte'
|
||||||
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data
|
let { photos, totalPhotos }: { photos: any[], totalPhotos: number } = data
|
||||||
$: ({ photos, totalPhotos } = data)
|
$: ({ photos, totalPhotos } = data)
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
settings {
|
settings {
|
||||||
@@ -36,4 +35,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { stagger, timeline } from 'motion'
|
import { stagger, timeline } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
import NewsletterIssue from '$components/molecules/NewsletterIssue.svelte'
|
import NewsletterIssue from '$components/molecules/NewsletterIssue.svelte'
|
||||||
import InteractiveGlobe from '$components/organisms/InteractiveGlobe.svelte'
|
import InteractiveGlobe from '$components/organisms/InteractiveGlobe.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
const { issues } = data
|
const { issues } = data
|
||||||
const latestIssue = issues[0]
|
const latestIssue = issues[0]
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
legal {
|
legal {
|
||||||
@@ -24,4 +23,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types'
|
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||||
// Components
|
// Components
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
import Metas from '$components/Metas.svelte'
|
import Metas from '$components/Metas.svelte'
|
||||||
import Heading from '$components/molecules/Heading.svelte'
|
import Heading from '$components/molecules/Heading.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
const { legal } = data
|
const { legal } = data
|
||||||
|
|
||||||
dayjs.extend(relativeTime)
|
dayjs.extend(relativeTime)
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { LayoutServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { PUBLIC_PREVIEW_COUNT } from '$env/static/public'
|
import { PUBLIC_PREVIEW_COUNT } from '$env/static/public'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async () => {
|
export const load = async ({ url }) => {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
locations: location (filter: { status: { _eq: "published" }}) {
|
locations: location (filter: { status: { _eq: "published" }}) {
|
||||||
@@ -102,4 +101,4 @@ export const load = (async () => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err || 'Failed to fetch data')
|
throw error(500, err || 'Failed to fetch data')
|
||||||
}
|
}
|
||||||
}) satisfies LayoutServerLoad
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import { beforeNavigate } from '$app/navigation'
|
import { beforeNavigate } from '$app/navigation'
|
||||||
import { PUBLIC_ANALYTICS_DOMAIN } from '$env/static/public'
|
import { PUBLIC_ANALYTICS_DOMAIN } from '$env/static/public'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { onMount, setContext } from 'svelte'
|
import { onMount, setContext } from 'svelte'
|
||||||
import { pageLoading, previousPage } from '$utils/stores'
|
import { pageLoading, previousPage } from '$utils/stores'
|
||||||
import '$utils/polyfills'
|
import '$utils/polyfills'
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
import Switcher from '$components/molecules/Switcher.svelte'
|
import Switcher from '$components/molecules/Switcher.svelte'
|
||||||
import Footer from '$components/organisms/Footer.svelte'
|
import Footer from '$components/organisms/Footer.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
let innerHeight: number
|
let innerHeight: number
|
||||||
$: innerHeight && document.body.style.setProperty('--vh', `${innerHeight}px`)
|
$: innerHeight && document.body.style.setProperty('--vh', `${innerHeight}px`)
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
import { getRandomItems } from 'utils/array'
|
import { getRandomItems } from 'utils/array'
|
||||||
|
|
||||||
|
|
||||||
export const load = (async ({ setHeaders }) => {
|
export const load = async ({ setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
// Get total of published photos
|
// Get total of published photos
|
||||||
const totalRes = await fetchAPI(`query {
|
const totalRes = await fetchAPI(`query {
|
||||||
@@ -53,4 +52,4 @@ export const load = (async ({ setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies PageServerLoad
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { navigating } from '$app/stores'
|
import { navigating } from '$app/stores'
|
||||||
import type { PageData } from './$types'
|
|
||||||
import { getContext, onMount } from 'svelte'
|
import { getContext, onMount } from 'svelte'
|
||||||
import { timeline, stagger } from 'motion'
|
import { timeline, stagger } from 'motion'
|
||||||
import { DELAY } from '$utils/constants'
|
import { DELAY } from '$utils/constants'
|
||||||
@@ -28,7 +27,7 @@
|
|||||||
import ShopModule from '$components/organisms/ShopModule.svelte'
|
import ShopModule from '$components/organisms/ShopModule.svelte'
|
||||||
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
import NewsletterModule from '$components/organisms/NewsletterModule.svelte'
|
||||||
|
|
||||||
export let data: PageData
|
export let data
|
||||||
|
|
||||||
const { photos } = data
|
const { photos } = data
|
||||||
const { settings, locations }: any = getContext('global')
|
const { settings, locations }: any = getContext('global')
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { NEWSLETTER_API_TOKEN, NEWSLETTER_LIST_ID } from '$env/static/private'
|
import { NEWSLETTER_API_TOKEN, NEWSLETTER_LIST_ID } from '$env/static/private'
|
||||||
import type { RequestHandler } from './$types'
|
|
||||||
|
|
||||||
|
|
||||||
export const POST = (async ({ request, fetch }) => {
|
export const POST = async ({ request, fetch }) => {
|
||||||
const data: { email: string } = await request.json()
|
const data: { email: string } = await request.json()
|
||||||
const { email } = data
|
const { email } = data
|
||||||
|
|
||||||
@@ -38,4 +37,4 @@ export const POST = (async ({ request, fetch }) => {
|
|||||||
}), {
|
}), {
|
||||||
status: 200
|
status: 200
|
||||||
})
|
})
|
||||||
}) satisfies RequestHandler
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { RequestHandler } from './$types'
|
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI } from '$utils/api'
|
||||||
|
|
||||||
|
|
||||||
export const GET = (async ({ url, setHeaders }) => {
|
export const GET = async ({ url, setHeaders }) => {
|
||||||
try {
|
try {
|
||||||
const locations = []
|
const locations = []
|
||||||
const products = []
|
const products = []
|
||||||
@@ -72,7 +71,7 @@ export const GET = (async ({ url, setHeaders }) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw error(500, err.message)
|
throw error(500, err.message)
|
||||||
}
|
}
|
||||||
}) satisfies RequestHandler
|
}
|
||||||
|
|
||||||
|
|
||||||
const render = (origin: string, pages: any[]) => {
|
const render = (origin: string, pages: any[]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user