Return specific error message if location doesn't exist
This commit is contained in:
@@ -27,8 +27,6 @@
|
||||
export let totalPhotos: number
|
||||
export let product: any
|
||||
|
||||
console.log(product)
|
||||
|
||||
dayjs.extend(relativeTime)
|
||||
|
||||
const { params } = $page
|
||||
|
||||
@@ -76,8 +76,11 @@ export async function GET ({ params }: RequestEvent): Promise<RequestHandlerOutp
|
||||
`)
|
||||
const { data: { location: location, photos, total_published, product }} = res
|
||||
|
||||
if (params.country !== location[0].country.slug || !location.length) {
|
||||
return { status: 404 }
|
||||
if (!location.length || location.length && params.country !== location[0].country.slug) {
|
||||
return {
|
||||
status: 404,
|
||||
body: Error("This location is not available… yet,"),
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user