Use layout server types
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
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: PageServerLoad = async () => {
|
export const load: LayoutServerLoad = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
locations: location (filter: { status: { _eq: "published" }}) {
|
locations: location (filter: { status: { _eq: "published" }}) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
import type { PageServerLoad } from './$types'
|
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: PageServerLoad = async () => {
|
export const load: LayoutServerLoad = async () => {
|
||||||
try {
|
try {
|
||||||
// Get content from API
|
// Get content from API
|
||||||
const res = await fetchAPI(`query {
|
const res = await fetchAPI(`query {
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ const cached = build.concat(files);
|
|||||||
.open(ASSETS)
|
.open(ASSETS)
|
||||||
.then(cache => cache.addAll(cached))
|
.then(cache => cache.addAll(cached))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// if you use typescript:
|
// if you use typescript:
|
||||||
(self as unknown as ServiceWorkerGlobalScope).skipWaiting();
|
(self as unknown as ServiceWorkerGlobalScope).skipWaiting();
|
||||||
// self.skipWaiting();
|
// self.skipWaiting();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user