Skip to content

Commit

Permalink
Merge pull request #606 from woowacourse-teams/feat/557-migrate-alert…
Browse files Browse the repository at this point in the history
…-to-toast

alert를 토스트 메세지로 대체
  • Loading branch information
solo5star authored Oct 20, 2023
2 parents de19e1a + d0a9098 commit 2b1e875
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/src/components/CafeMap.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Suspense, useEffect, useRef, useState } from 'react';
import { styled } from 'styled-components';
import { SEONGSU_BOUNDS_LOCATION, SEONGSU_CAFE_STREET_LOCATION, SEONGSU_MAP_INITIAL_ZOOM_SIZE } from '../constants';
import { useToast } from '../context/ToastContext';
import useCafesNearLocation from '../hooks/useCafesNearLocation';
import useCurrentPosition from '../hooks/useCurrentPosition';
import CafeMarkersContainer from './CafeMarkersContainer';
Expand Down Expand Up @@ -43,6 +44,7 @@ type CafeMapContentProps = {

const CafeMapContent = (props: CafeMapContentProps) => {
const { map } = props;
const showToast = useToast();

const currentPosition = useCurrentPosition();
const { refetch } = useCafesNearLocation(map);
Expand All @@ -62,7 +64,7 @@ const CafeMapContent = (props: CafeMapContentProps) => {
setPosition(currentPosition);
} else {
// 경고 메시지를 표시합니다.
alert('서비스는 성수 지역에서만 이용 가능합니다.');
showToast('warning', '서비스는 성수 지역에서만 이용 가능합니다.');
map.panTo(SEONGSU_CAFE_STREET_LOCATION);
setPosition(SEONGSU_CAFE_STREET_LOCATION);
}
Expand Down

0 comments on commit 2b1e875

Please sign in to comment.