import React, { useState, useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import ohuh from '../ohuh.PNG';
import { Container, Row, Form, Image, InputGroup, Button, Col, Card } from 'react-bootstrap';
import axios from 'axios';
import Place from '../Components/Place';
function App() {
const [state, setState] = useState(false);
const [search, setSearch] = useState("");
const [show, setShow] = useState(false);
const [recommend, setRecommend] = useState([{ name: " ", address: " ", img: " " }]);
const [latest, setLatest] = useState([{ name: " ", address: " ", img: " " }]);
useEffect(() => {
getRecommend()
getLatest()
}, []);
if (state !== false) {
return ;
}
const handleChange = (e) => {
setSearch(e.target.value);
}
const handleSubmit = () => {
setState(true);
}
const getRecommend = () => {
axios.get(`/api/app/recommend`)
.then(res => {
setRecommend(res.data)
})
.catch(err => {
console.log("APP RECOMMEND ERROR", err)
})
}
const getLatest = () => {
axios.get(`/api/app/lastest`)
.then(res => {
setLatest(res.data)
})
.catch(err => {
console.log("APP LATEST ERROR", err)
})
}
return (
인기관광지
{recommend.name}
{recommend.address}
setShow(false)} />
최근 검색관광지
{latest.name}
{latest.address}
setShow(false)} />
);
}
export default App;