feat: run server functions on edge
This commit is contained in:
@@ -3,6 +3,10 @@ import type { PageServerLoad } from './$types'
|
||||
import { PUBLIC_LIST_AMOUNT } from '$env/static/public'
|
||||
import { fetchAPI, photoFields } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ params, setHeaders }) => {
|
||||
try {
|
||||
const { location: slug } = params
|
||||
|
||||
@@ -2,6 +2,10 @@ import { error } from '@sveltejs/kit'
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ params, setHeaders }) => {
|
||||
try {
|
||||
// Get the first photo ID
|
||||
|
||||
@@ -3,6 +3,10 @@ import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
import { getRandomItems } from 'utils/array'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ setHeaders }) => {
|
||||
try {
|
||||
// Get data and total of published photos
|
||||
|
||||
@@ -2,6 +2,10 @@ import { error } from '@sveltejs/kit'
|
||||
import type { RequestHandler } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const POST = (async ({ request, setHeaders }) => {
|
||||
try {
|
||||
const body = await request.text()
|
||||
|
||||
@@ -2,6 +2,10 @@ import { error } from '@sveltejs/kit'
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ setHeaders }) => {
|
||||
try {
|
||||
const res = await fetchAPI(`query {
|
||||
|
||||
@@ -3,6 +3,10 @@ import type { RequestHandler } from './$types'
|
||||
import { fetchSwell } from '$utils/functions/shopServer'
|
||||
import { fetchAPI, getAssetUrlKey } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
const gCategories = [
|
||||
{
|
||||
id: '61851d83cd16416c78a8e5ef',
|
||||
|
||||
3
apps/website/src/routes/(site)/locations/+page.server.ts
Normal file
3
apps/website/src/routes/(site)/locations/+page.server.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
@@ -3,6 +3,10 @@ import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
import { PUBLIC_FILTERS_DEFAULT_COUNTRY, PUBLIC_FILTERS_DEFAULT_SORT, PUBLIC_GRID_AMOUNT } from '$env/static/public'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ url, setHeaders }) => {
|
||||
try {
|
||||
// Query parameters
|
||||
|
||||
@@ -2,6 +2,10 @@ import { error } from '@sveltejs/kit'
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ setHeaders }) => {
|
||||
try {
|
||||
const res = await fetchAPI(`query {
|
||||
|
||||
@@ -2,6 +2,10 @@ import { error } from '@sveltejs/kit'
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { fetchAPI } from '$utils/api'
|
||||
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export const load = (async ({ setHeaders }) => {
|
||||
try {
|
||||
const res = await fetchAPI(`query {
|
||||
|
||||
Reference in New Issue
Block a user