diff --git a/src/pages/[...page].astro b/src/pages/[...page].astro index 0f1c9d9..4865e9d 100644 --- a/src/pages/[...page].astro +++ b/src/pages/[...page].astro @@ -1,6 +1,9 @@ --- // import { getPathPartsFromAstroRequest } from '~/helpers/url.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import Layout from '../layouts/default.astro' import LinkButton from '~/components/link-button.vue' @@ -19,6 +22,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + // https://docs.astro.build/en/reference/api-reference/#astroresponse Astro.response.status = 404 Astro.response.statusText = 'Not found' diff --git a/src/pages/app/[...appPath].astro b/src/pages/app/[...appPath].astro index 332cd0e..6caa403 100644 --- a/src/pages/app/[...appPath].astro +++ b/src/pages/app/[...appPath].astro @@ -3,7 +3,10 @@ // https://docs.astro.build/core-concepts/astro-components/ import { DoesItAPI } from '~/helpers/api/client.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { getVideoImages, ListingDetails @@ -21,6 +24,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + // Get type and slug from the request path // so that we don't have extra parts for diff --git a/src/pages/device/[...devicePath].astro b/src/pages/device/[...devicePath].astro index 8797b0d..b2bc3de 100644 --- a/src/pages/device/[...devicePath].astro +++ b/src/pages/device/[...devicePath].astro @@ -5,7 +5,10 @@ import { DoesItAPI } from '~/helpers/api/client.js' import { getPathPartsFromAstroRequest } from '~/helpers/url.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { deviceSupportsApp } from '~/helpers/devices.js' @@ -31,6 +34,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + const device = await DoesItAPI.device( pathSlug ).get() const rawAppPage = await DoesItAPI.kind( 'app' )( subSlug ).get() diff --git a/src/pages/formula/[...formulaPath].astro b/src/pages/formula/[...formulaPath].astro index 94076a6..fcdd7c7 100644 --- a/src/pages/formula/[...formulaPath].astro +++ b/src/pages/formula/[...formulaPath].astro @@ -3,7 +3,10 @@ // https://docs.astro.build/core-concepts/astro-components/ import { DoesItAPI } from '~/helpers/api/client.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { ListingDetails } from '~/helpers/listing-page.js' @@ -19,6 +22,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + // Get type and slug from the request path // so that we don't have extra parts for diff --git a/src/pages/game/[...gamePath].astro b/src/pages/game/[...gamePath].astro index 1b4e573..cadb641 100644 --- a/src/pages/game/[...gamePath].astro +++ b/src/pages/game/[...gamePath].astro @@ -3,7 +3,10 @@ // https://docs.astro.build/core-concepts/astro-components/ import { DoesItAPI } from '~/helpers/api/client.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { getVideoImages, ListingDetails @@ -21,6 +24,7 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) // Get type and slug from the request path // so that we don't have extra parts for diff --git a/src/pages/games.astro b/src/pages/games.astro index 80de9a6..dd088cb 100644 --- a/src/pages/games.astro +++ b/src/pages/games.astro @@ -5,7 +5,10 @@ import { DoesItAPI } from '~/helpers/api/client.js' import { getPathPartsFromAstroRequest } from '~/helpers/url.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { categories, makeCategoryFilterFromCategorySlug @@ -33,6 +36,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + const rawKindPage = await DoesItAPI.kind( 'game' )( 1 ).get() // Clean up unused kind data diff --git a/src/pages/kind/[...kindPath].astro b/src/pages/kind/[...kindPath].astro index 10b4b6b..259eb29 100644 --- a/src/pages/kind/[...kindPath].astro +++ b/src/pages/kind/[...kindPath].astro @@ -5,7 +5,10 @@ import { DoesItAPI } from '~/helpers/api/client.js' import { getPathPartsFromAstroRequest } from '~/helpers/url.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults +} from '~/helpers/astro/request.js' import { categories, getKindToCategorySlug, @@ -34,6 +37,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + // Try the pathSlug against categories // so we can load from category slugs diff --git a/src/pages/tv/[...videoPath].astro b/src/pages/tv/[...videoPath].astro index f95019f..249672e 100644 --- a/src/pages/tv/[...videoPath].astro +++ b/src/pages/tv/[...videoPath].astro @@ -3,7 +3,10 @@ // https://docs.astro.build/core-concepts/astro-components/ import { DoesItAPI } from '~/helpers/api/client.js' -import { catchRedirectResponse } from '~/helpers/astro/request.js' +import { + catchRedirectResponse, + applyResponseDefaults + } from '~/helpers/astro/request.js' import { getVideoImages, ListingDetails @@ -20,6 +23,8 @@ if ( redirectResponse !== null ) { return redirectResponse } +applyResponseDefaults( Astro ) + // Get type and slug from the request path // so that we don't have extra parts for