Skip to content

Commit

Permalink
feat: 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
urimeee committed Feb 19, 2025
1 parent aae7ad9 commit aadb391
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hooks/useSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const useSchedules = () => {
getSchedules();
}, []);

useEffect(() => {
console.log('scheduleList 변경됨 useSchedule');
}, [scheduleList]);

const getSchedules = async () => {
try {
await api.get('/schedules').then((response) => {
Expand All @@ -30,8 +34,9 @@ const useSchedules = () => {
setSchedule('');
e.preventDefault();

await api.post('/schedules', { text: schedule }).then(() => {
getSchedules();
await api.post('/schedules', { text: schedule }).then(async () => {
const updatedSchedules = await getSchedules();
setScheduleList((prev) => [...prev, updatedSchedules]);
});
} catch (e) {
console.error(e);
Expand Down

0 comments on commit aadb391

Please sign in to comment.