Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: build error #44

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading