28 lines
771 B
TypeScript
28 lines
771 B
TypeScript
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: 'Не удалось получить точки ПВЗ' }
|
||
}
|
||
})
|