Move API fields to file
This commit is contained in:
@@ -1,20 +1,8 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
import type { PageServerLoad } from './$types'
|
||||||
import { PUBLIC_LIST_AMOUNT } from '$env/static/public'
|
import { PUBLIC_LIST_AMOUNT } from '$env/static/public'
|
||||||
import { fetchAPI } from '$utils/api'
|
import { fetchAPI, photoFields } from '$utils/api'
|
||||||
|
|
||||||
export const photoFields = `
|
|
||||||
title
|
|
||||||
slug
|
|
||||||
city
|
|
||||||
image {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
width, height
|
|
||||||
}
|
|
||||||
date_taken
|
|
||||||
date_created
|
|
||||||
`
|
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params }) => {
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
import { quartOut } from '$animations/easings'
|
import { quartOut } from '$animations/easings'
|
||||||
import { getAssetUrlKey } from '$utils/api'
|
import { getAssetUrlKey } from '$utils/api'
|
||||||
import { DELAY } from '$utils/contants'
|
import { DELAY } from '$utils/contants'
|
||||||
import { photoFields } from './+page.server'
|
import { photoFields } from '$utils/api'
|
||||||
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
|
import { PUBLIC_LIST_INCREMENT } from '$env/static/public'
|
||||||
// Components
|
// Components
|
||||||
import Metas from '$components/Metas.svelte'
|
import Metas from '$components/Metas.svelte'
|
||||||
|
|||||||
@@ -43,6 +43,23 @@ export const getAssetUrlKey = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GraphQL fields
|
||||||
|
*/
|
||||||
|
export const photoFields = `
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
city
|
||||||
|
image {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
width, height
|
||||||
|
}
|
||||||
|
date_taken
|
||||||
|
date_created
|
||||||
|
`
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Directus asset URL from parameters
|
* Get a Directus asset URL from parameters
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user