Skip to content

Commit

Permalink
ENH:get받아오기 성공
Browse files Browse the repository at this point in the history
  • Loading branch information
yeon-jae committed Feb 21, 2023
1 parent d16e3b2 commit fc28672
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const App = () => {
return (
<>
<Route component={MainPage} path="/cotato" />
<Route component={Board} path="/Board" />
<Route component={Board} path="/board" />
<Route component={Login} path="/login" />
<Route component={Register} path="/register" />
<Route component={VotePage} path="/vote" />
Expand Down
44 changes: 42 additions & 2 deletions frontend/src/Components/calendar/CalendarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,52 @@ const SUBMIT_FORMAT = {




function CalendarView(){

const [newEvent, setNewEvent] = useState({ title: "", start: "", end: "" });
const [allEvents, setAllEvents] = useState(events);


const [date, setDate]=useState({
postId:"",
authorId:"",
content:"",
startYear:"",
startMonth:"",
startDay:"",
endYear:"",
endMonth:"",
endDay:""
})

useEffect(()=>{
loadUser();
}, []);

const loadUser=async ()=>{
const result=await axios.get(`http://localhost:8080/cotato`)
.then(function (response) {
console.log(response.data);
let appointments = response.data;

for (let i = 0; i < appointments.length; i++) {
var startDate = appointments[i].startYear+"-"+appointments[i].startMonth+"-"+appointments[i].startDay;
var endDate = appointments[i].endYear+"-"+appointments[i].endMonth+"-"+appointments[i].endDay;

newEvent.title = appointments[i].content;
newEvent.start = startDate;
newEvent.end = endDate;

events.fill(setNewEvent(appointments[i].content, startDate, endDate));

console.log(appointments[i])
}

})
.catch(function (error) {
console.log(error);
});

}

const onSubmit= async(e) => {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring.datasource.url = jdbc:mysql://localhost:3306/cotato
spring.datasource.username = root
spring.datasource.password = cotatolove
spring.datasource.password = 0000
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver

spring.jpa.hibernate.ddl-auto = create
Expand Down

0 comments on commit fc28672

Please sign in to comment.