{"version":3,"file":"BYsRFn-2.js","sources":["../../../../src/middleware/blog-slug-validator.ts"],"sourcesContent":["export default defineNuxtRouteMiddleware(async (to) => {\n try {\n const response = await fetch(`https://blog.compralovendelo.com/wp-json/wp/v2/posts?slug=${to.params.slug}`);\n const data = await response.json()\n\n if (data.length == 0) {\n throw new Error('Post no encontrado...')\n }\n\n const post = useState('post')\n post.value = data[0]\n\n\n } catch (e) {\n console.error(\"Error al obtener los posts:\", e);\n throw createError({\n statusCode: 404,\n statusMessage: `${e}`,\n });\n }\n})"],"names":["blogSlugValidator","defineNuxtRouteMiddleware","to","__temp","__restore","response","__executeAsync","data","post","useState","e","createError"],"mappings":"0DACI,MAAIA,EAAAC,EAAA,MAAAC,GAAA,CAAA,IAAAC,EAAAC,EACA,GAAA,CACM,MAAAC,GAAa,CAAAF,EAAAC,CAAA,EAAAE,EAAA,IAAA,MAAc,6DAAAJ,EAAA,OAAA,IAAA,EAAA,CAAA,EAAAC,EAAA,MAAAA,EAAAC,IAAAD,GAE7BI,MAAkBH,CAAA,EAAAE,EAAA,IAAAD,EAAA,KAAA,CAAA,EAAAF,EAAA,MAAAA,EAAAC,EAAA,EAAAD,GACZ,GAAAI,EAAA,QAAiC,EAC3C,MAAA,IAAA,MAAA,uBAAA,EAGK,MAAAC,EAAQC,EAAM,MAAA,UAGXF,EAAA,CAAA,CACA,OAAAG,EAAA,CACR,cAAkB,MAAA,8BAAAA,CAAA,EACFC,EAAA,CACZ,WAAA,IACH,cAAA,GAAAD,CAAA,EAAA,CACL,CACH"}