Skip to content

Commit

Permalink
Merge pull request #44 from 4bujak-4bujak/feature/meetingroomQA
Browse files Browse the repository at this point in the history
fix: build error
  • Loading branch information
jiohjung98 authored Jun 9, 2024
2 parents 60f13f7 + 86ca45f commit e0dd264
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/components/map/BranchInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const BranchInfo: React.FC = () => {

const [currentSlide, setCurrentSlide] = useState(1);
const totalSlides = 2;

const branchName = router.query.name as string;
const address = router.query.address as string;
const branchPhoneNumber = router.query.branchPhoneNumber as string;
Expand All @@ -38,7 +38,7 @@ const BranchInfo: React.FC = () => {
['branch3-1.png', 'branch3-2.png']
];

const hash = Array.from(branchName).reduce((acc: number, char: string) => acc + char.charCodeAt(0), 0);
const hash = Array.from(branchName || "").reduce((acc: number, char: string) => acc + char.charCodeAt(0), 0);
const pairIndex = hash % imagePairs.length;

const selectedImagePair = imagePairs[pairIndex];
Expand All @@ -48,18 +48,15 @@ const BranchInfo: React.FC = () => {

const numericBranchId = Array.isArray(branchId) ? parseInt(branchId[0], 10) : parseInt(branchId as string, 10);

const [activeTab, setActiveTab] = useState('meetingRoom');

console.log(branchId);
console.log(numericBranchId)
const [activeTab, setActiveTab] = useState('meetingRoom');

useEffect(() => {
const fetchData = async () => {
try {
const data = await getOfficeMeetingRoomCount(branchId as unknown as number);
const data = await getOfficeMeetingRoomCount(numericBranchId);
if (data.data) {
console.log(data);
console.log(data.data);
console.log(data.data);
}
} catch (error) {
console.error('Error updating selected branch:', error);
Expand All @@ -70,7 +67,6 @@ const BranchInfo: React.FC = () => {
}
}, [numericBranchId]);


useEffect(() => {
if (branchName && address && branchPhoneNumber && roadFromStation && stationToBranch && numericBranchId) {
localStorage.setItem(
Expand Down Expand Up @@ -125,7 +121,7 @@ const BranchInfo: React.FC = () => {
setReservedBranch(data?.data, Date.now());
router.push({
pathname: '/reservation',
query: { tab: activeTab },
query: { tab: activeTab },
});
}
} catch (error) {
Expand Down

0 comments on commit e0dd264

Please sign in to comment.