from 'styled-components'
import axios from 'axios'
const Ticket = () => {
const GET_ID_URl = 'https://front-test.beta.aviasales.ru/search';
const GET_TICKETS_URL ='https://front-test.beta.aviasales.ru/tickets?searchId='
const [ID, setID] = useState('')
const [Tickets, setTickets] = useState({ tickets: [] })
useEffect(async () => {
const GET_ID_URl = 'https://front-test.beta.aviasales.ru/search';
const GET_TICKETS_URL ='https://front-test.beta.aviasales.ru/tickets?searchId='
const [ID, setID] = useState('')
const fetchID = () => {
try {
const resID = await axios.get(GET_ID_URl)
setID(resID.statusText);
}
catch (error) {
alert(error)
}
try {
const FetchTickets = () => {
const resTICKETS = await axios.get(GET_TICKETS_URL${restID.data})
setID(resTICKETS.statusText)
}
} catch (error) {
alert(error)
}
fetchID();
FetchTickets()
};
})
return (
<ul>
<li>hello</li>
</ul>
)
}
export default Ticket
к чему это?
Обсуждают сегодня