Skip to content

Commit

Permalink
[예약목록] 예약목록이 rendering 될 때마다, refetch, refetch 될 때마다 loading = true (#56
Browse files Browse the repository at this point in the history
)
  • Loading branch information
SeonghakIm authored Dec 4, 2021
1 parent 2f022d4 commit 31e579c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/Reservations/ReservationsPresenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ReservationsPresenter: React.FC<ReservationPresenterProps> = ({
cancelReservation,
reserveSeat,
}) => {
const { data, loading } = useMeQuery();
const { data, loading, refetch } = useMeQuery({ notifyOnNetworkStatusChange : true });
const [clicked, setClicked] = useState('');
const [modal, setModal] = useState({isOpen:false, isCancel:false});
const [reservations, setReservations] = useState(data?.me.reservations || []);
Expand All @@ -43,6 +43,10 @@ export const ReservationsPresenter: React.FC<ReservationPresenterProps> = ({
const reserved = reservations.filter(
reservation => reservation.status === ReservationStatus.Reserved,
);

useEffect(()=>{
refetch()
},[])

useEffect(() => {
setReservations(reservations => data?.me.reservations || []);
Expand Down

0 comments on commit 31e579c

Please sign in to comment.