paxton-front/server/api/yandex.ts
alsaze c38b6ba6a9
All checks were successful
Deploy / build (push) Successful in 2m24s
карта ПВЗ
2025-10-17 02:44:33 +03:00

28 lines
771 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from 'axios'
import { defineEventHandler } from 'h3'
export default defineEventHandler(async () => {
const businessId = '216467845'
const token = 'ACMA:jSy96waKHy8jbq5NqjlGy77WarNYKOYO8aEgjExw:b9ff0949'
try {
const response = await axios.post(
`https://api.partner.market.yandex.ru/v2/businesses/${businessId}/logistics-points`,
{},
{
headers: {
'Content-Type': 'application/json',
'Accept-Language': 'ru-RU',
'Authorization': `Bearer ${token}`,
},
},
)
return response.data
}
catch (error) {
console.error('Ошибка при запросе к Яндекс API:', error)
return { error: 'Не удалось получить точки ПВЗ' }
}
})