mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Use Response Defaults on templates
This commit is contained in:
parent
38ff3bb510
commit
b665e100af
8 changed files with 47 additions and 8 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
---
|
---
|
||||||
// import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
// 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 Layout from '../layouts/default.astro'
|
||||||
import LinkButton from '~/components/link-button.vue'
|
import LinkButton from '~/components/link-button.vue'
|
||||||
|
|
@ -19,6 +22,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
// https://docs.astro.build/en/reference/api-reference/#astroresponse
|
// https://docs.astro.build/en/reference/api-reference/#astroresponse
|
||||||
Astro.response.status = 404
|
Astro.response.status = 404
|
||||||
Astro.response.statusText = 'Not found'
|
Astro.response.statusText = 'Not found'
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
// https://docs.astro.build/core-concepts/astro-components/
|
// https://docs.astro.build/core-concepts/astro-components/
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
getVideoImages,
|
getVideoImages,
|
||||||
ListingDetails
|
ListingDetails
|
||||||
|
|
@ -21,6 +24,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
|
|
||||||
// Get type and slug from the request path
|
// Get type and slug from the request path
|
||||||
// so that we don't have extra parts for
|
// so that we don't have extra parts for
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { getPathPartsFromAstroRequest } from '~/helpers/url.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'
|
import { deviceSupportsApp } from '~/helpers/devices.js'
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -31,6 +34,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
const device = await DoesItAPI.device( pathSlug ).get()
|
const device = await DoesItAPI.device( pathSlug ).get()
|
||||||
const rawAppPage = await DoesItAPI.kind( 'app' )( subSlug ).get()
|
const rawAppPage = await DoesItAPI.kind( 'app' )( subSlug ).get()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
// https://docs.astro.build/core-concepts/astro-components/
|
// https://docs.astro.build/core-concepts/astro-components/
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
ListingDetails
|
ListingDetails
|
||||||
} from '~/helpers/listing-page.js'
|
} from '~/helpers/listing-page.js'
|
||||||
|
|
@ -19,6 +22,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
|
|
||||||
// Get type and slug from the request path
|
// Get type and slug from the request path
|
||||||
// so that we don't have extra parts for
|
// so that we don't have extra parts for
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
// https://docs.astro.build/core-concepts/astro-components/
|
// https://docs.astro.build/core-concepts/astro-components/
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
getVideoImages,
|
getVideoImages,
|
||||||
ListingDetails
|
ListingDetails
|
||||||
|
|
@ -21,6 +24,7 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
// Get type and slug from the request path
|
// Get type and slug from the request path
|
||||||
// so that we don't have extra parts for
|
// so that we don't have extra parts for
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
categories,
|
categories,
|
||||||
makeCategoryFilterFromCategorySlug
|
makeCategoryFilterFromCategorySlug
|
||||||
|
|
@ -33,6 +36,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
const rawKindPage = await DoesItAPI.kind( 'game' )( 1 ).get()
|
const rawKindPage = await DoesItAPI.kind( 'game' )( 1 ).get()
|
||||||
|
|
||||||
// Clean up unused kind data
|
// Clean up unused kind data
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
import { getPathPartsFromAstroRequest } from '~/helpers/url.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
categories,
|
categories,
|
||||||
getKindToCategorySlug,
|
getKindToCategorySlug,
|
||||||
|
|
@ -34,6 +37,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
|
|
||||||
// Try the pathSlug against categories
|
// Try the pathSlug against categories
|
||||||
// so we can load from category slugs
|
// so we can load from category slugs
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
// https://docs.astro.build/core-concepts/astro-components/
|
// https://docs.astro.build/core-concepts/astro-components/
|
||||||
|
|
||||||
import { DoesItAPI } from '~/helpers/api/client.js'
|
import { DoesItAPI } from '~/helpers/api/client.js'
|
||||||
import { catchRedirectResponse } from '~/helpers/astro/request.js'
|
import {
|
||||||
|
catchRedirectResponse,
|
||||||
|
applyResponseDefaults
|
||||||
|
} from '~/helpers/astro/request.js'
|
||||||
import {
|
import {
|
||||||
getVideoImages,
|
getVideoImages,
|
||||||
ListingDetails
|
ListingDetails
|
||||||
|
|
@ -20,6 +23,8 @@ if ( redirectResponse !== null ) {
|
||||||
return redirectResponse
|
return redirectResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyResponseDefaults( Astro )
|
||||||
|
|
||||||
|
|
||||||
// Get type and slug from the request path
|
// Get type and slug from the request path
|
||||||
// so that we don't have extra parts for
|
// so that we don't have extra parts for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue