This commit is contained in:
31
server/api/yandex.ts
Normal file
31
server/api/yandex.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
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: 'Не удалось получить точки ПВЗ' }
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user