карта ПВЗ
All checks were successful
Deploy / build (push) Successful in 12m45s

This commit is contained in:
alsaze
2025-10-22 22:57:29 +03:00
parent 3119ecc2fa
commit 8e68d5b162
14 changed files with 314 additions and 115 deletions

31
server/api/yandex_pvz.ts Normal file
View File

@@ -0,0 +1,31 @@
import axios from 'axios'
import { defineEventHandler, readBody } from 'h3'
export default defineEventHandler(async (event) => {
try {
const data = await readBody(event)
const apiUrl = process.env.VITE_YANDEX_B2B_BASE_URL!
const token = process.env.VITE_YANDEX_B2B_TOKEN!
const response = await axios.post(
`${apiUrl}/pickup-points/list`,
{
geo_id: data?.geo_id,
type: 'pickup_point',
},
{
headers: {
'Content-Type': 'application/json',
'Accept-Language': 'ru-RU',
'Authorization': `Bearer ${token}`,
},
},
)
return response.data
}
catch (error) {
console.error('Ошибка при запросе к Яндекс API:', error)
return { error: `Не удалось получить точки ПВЗ: ${error}` }
}
})