Skip to content

Commit

Permalink
feat: 세그먼트 새 위치 추가 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
gihwan-dev committed Oct 7, 2024
1 parent 7e5f9ce commit 66a782f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/common/SegmentControl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TextFieldV2 from '@/components/common/TextFieldV2';
import CenterBottomSheet from '@/components/common/CenterBottomSheet';

import { cn } from '@/utils.ts';
import { useAddNewLocation } from '@/queries/useAddNewLocation.ts';

interface Segment {
id: number;
Expand Down Expand Up @@ -37,6 +38,8 @@ const SegmentControl: React.FC<SegmentControlProps> = ({ segments, onSegmentChan
const [newLocationName, setNewLocationName] = useState<string>('');
const [isError, setIsError] = useState<boolean>(false);

const { mutate: addNewLocation } = useAddNewLocation();

const handleSegmentClick = (id: number) => {
setSelectedId(id);
const selectedSegment = defaultSegments.find((segment) => segment.id === id);
Expand All @@ -62,6 +65,7 @@ const SegmentControl: React.FC<SegmentControlProps> = ({ segments, onSegmentChan
};

const handleAddNewLocation = () => {
addNewLocation(newLocationName);
setIsModalOpen(false);
};

Expand Down

0 comments on commit 66a782f

Please sign in to comment.