Merged in feat/SW-1751-destination-0-results (pull request #1448)
feat(SW-1751): Added alert if no results are found, also implemented default location data from Contentstack * feat(SW-1751): Added alert if no results are found, also implemented default location data from Contentstack Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { z } from "zod"
|
||||
|
||||
export const mapLocationSchema = z
|
||||
.object({
|
||||
longitude: z.number().nullable(),
|
||||
latitude: z.number().nullable(),
|
||||
default_zoom: z.number().nullable(),
|
||||
})
|
||||
.nullish()
|
||||
.transform((val) => {
|
||||
if (val) {
|
||||
const longitude = val.longitude
|
||||
const latitude = val.latitude
|
||||
const default_zoom = val.default_zoom || 3
|
||||
|
||||
if (longitude !== null && latitude !== null) {
|
||||
return {
|
||||
longitude,
|
||||
latitude,
|
||||
default_zoom: Math.round(default_zoom),
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
})
|
||||
Reference in New Issue
Block a user