32 lines
812 B
TypeScript
32 lines
812 B
TypeScript
import axios from 'axios'
|
||
import { defineEventHandler } from 'h3'
|
||
|
||
export default defineEventHandler(async () => {
|
||
const token = 'y2_AgAAAAD04omrAAAPeAAAAAACRpC94Qk6Z5rUTgOcTgYFECJllXYKFx8'
|
||
|
||
try {
|
||
const response = await axios.post(
|
||
'https://b2b.taxi.tst.yandex.net/api/b2b/platform/pickup-points/list',
|
||
{
|
||
filters: {
|
||
region_ids: [213],
|
||
},
|
||
limit: 5,
|
||
},
|
||
{
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
'Accept-Language': 'ru-RU',
|
||
'Authorization': `Bearer ${token}`,
|
||
},
|
||
},
|
||
)
|
||
|
||
return response.data
|
||
}
|
||
catch (error) {
|
||
console.error('Ошибка при запросе к Яндекс API:', error)
|
||
return { error: 'Не удалось получить точки ПВЗ' }
|
||
}
|
||
})
|