diff --git a/src/api/auth/auth.post.api.ts b/src/api/auth/auth.post.api.ts index 0d6f1ef..6339fc9 100644 --- a/src/api/auth/auth.post.api.ts +++ b/src/api/auth/auth.post.api.ts @@ -41,7 +41,7 @@ export const signin = async ({ email, password }: ISignIn) => { email, password }); - console.log('실행1'); + return response; }; diff --git a/src/api/map/getOfficeAvailable.ts b/src/api/map/getOfficeAvailable.ts index 0285c70..474fc21 100644 --- a/src/api/map/getOfficeAvailable.ts +++ b/src/api/map/getOfficeAvailable.ts @@ -1,35 +1,42 @@ import { BranchAvailable } from '@/api/types/branch'; function formatLocalDate() { - const now = new Date(); - const offset = now.getTimezoneOffset() * 60000; - const localISOTime = new Date(now.getTime() - offset).toISOString().slice(0, -1); - return localISOTime.split('.')[0]; - } - - export const getOfficeAvailable = async (name: string): Promise<{ data: BranchAvailable }> => { - try { - const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; - const now = formatLocalDate(); - console.log(encodeURIComponent(name)); - const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1"); - const response = await fetch(`${backendUrl}branches/${encodeURIComponent(name)}/space?now=${encodeURIComponent(now)}`, { + const now = new Date(); + const offset = now.getTimezoneOffset() * 60000; + const localISOTime = new Date(now.getTime() - offset).toISOString().slice(0, -1); + return localISOTime.split('.')[0]; +} + +export const getOfficeAvailable = async ( + name: string +): Promise<{ data: BranchAvailable }> => { + try { + const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; + const now = formatLocalDate(); + + const token = document.cookie.replace( + /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, + '$1' + ); + const response = await fetch( + `${backendUrl}branches/${encodeURIComponent(name)}/space?now=${encodeURIComponent(now)}`, + { method: 'GET', headers: { - 'Authorization': `Bearer ${token}`, + Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, cache: 'no-store' - }); - if (!response.ok) { - throw new Error('Failed to fetch branch information'); } - const data: { data: BranchAvailable } = await response.json(); - console.log(data); - return data; - } catch (error) { - console.error('Error fetching branch info:', error); - throw error; + ); + if (!response.ok) { + throw new Error('Failed to fetch branch information'); } - }; - \ No newline at end of file + const data: { data: BranchAvailable } = await response.json(); + + return data; + } catch (error) { + console.error('Error fetching branch info:', error); + throw error; + } +}; diff --git a/src/api/reservation/getMeetingRoomInfo.ts b/src/api/reservation/getMeetingRoomInfo.ts index 25e42d4..d2982a2 100644 --- a/src/api/reservation/getMeetingRoomInfo.ts +++ b/src/api/reservation/getMeetingRoomInfo.ts @@ -1,11 +1,16 @@ import { MeetingRoomInfo } from '../types/room'; -export const getMeetingRoomInfo = async (meetingRoomId: string): Promise => { +export const getMeetingRoomInfo = async ( + meetingRoomId: string +): Promise => { const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; const url = `${backendUrl}spaces/meeting-rooms/${meetingRoomId}`; - const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1"); - + const token = document.cookie.replace( + /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, + '$1' + ); + if (!token) { throw new Error('No access token found'); } @@ -13,18 +18,20 @@ export const getMeetingRoomInfo = async (meetingRoomId: string): Promise => { const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; const url = `${backendUrl}reservations/meeting-rooms`; - const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1"); + const token = document.cookie.replace( + /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, + '$1' + ); if (!token) { throw new Error('No access token found'); @@ -13,16 +16,16 @@ export const reserveMeetingRoom = async (reservation: Reserve): Promise => const response = await fetch(url, { method: 'POST', headers: { - 'Authorization': `Bearer ${token}`, + Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify(reservation) }); - console.log(response); - if (!response.ok) { const errorText = await response.text(); - throw new Error(`Error reserving meeting room: ${response.status} ${response.statusText} - ${errorText}`); + throw new Error( + `Error reserving meeting room: ${response.status} ${response.statusText} - ${errorText}` + ); } }; diff --git a/src/api/reservation/searchMembers.ts b/src/api/reservation/searchMembers.ts index 0b1e76a..727236a 100644 --- a/src/api/reservation/searchMembers.ts +++ b/src/api/reservation/searchMembers.ts @@ -1,31 +1,38 @@ import { Member } from '../types/member'; -export const searchMembers = async (searchTerm: string, startAt: string, endAt: string): Promise<{ memberCanInviteList: Member[], memberCantInviteList: Member[] }> => { +export const searchMembers = async ( + searchTerm: string, + startAt: string, + endAt: string +): Promise<{ memberCanInviteList: Member[]; memberCantInviteList: Member[] }> => { const backendUrl = process.env.NEXT_PUBLIC_BASE_URL; const url = `${backendUrl}reservations/members?startAt=${startAt}&endAt=${endAt}&searchTerm=${searchTerm}`; - const token = document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1"); - + const token = document.cookie.replace( + /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, + '$1' + ); + if (!token) { throw new Error('No access token found'); } - console.log(searchTerm,startAt,endAt) const response = await fetch(url, { method: 'GET', headers: { - 'Authorization': `Bearer ${token}`, + Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' - }, + } }); if (!response.ok) { const errorText = await response.text(); - throw new Error(`Error searching members: ${response.status} ${response.statusText} - ${errorText}`); + throw new Error( + `Error searching members: ${response.status} ${response.statusText} - ${errorText}` + ); } const data = await response.json(); - console.log(data); if (data.status !== 'SUCCESS') { throw new Error(`API Error: ${data.errorCode}`); diff --git a/src/components/community/hooks/useNoticeGet.ts b/src/components/community/hooks/useNoticeGet.ts index df5f05d..3798ede 100644 --- a/src/components/community/hooks/useNoticeGet.ts +++ b/src/components/community/hooks/useNoticeGet.ts @@ -10,7 +10,6 @@ const useNoticeGet = (sortType: string) => { const ref = useRef(null); const pageRef = useIntersectionObserver(ref, {}); const isPageEnd = !!pageRef?.isIntersecting; - console.log(isPageEnd); const { data, fetchNextPage, diff --git a/src/components/map/BranchInfo.tsx b/src/components/map/BranchInfo.tsx index 417445f..2a9c836 100644 --- a/src/components/map/BranchInfo.tsx +++ b/src/components/map/BranchInfo.tsx @@ -20,7 +20,10 @@ const getBranchImage = (imageName: string): string => { const BranchInfo: React.FC = () => { const router = useRouter(); const { setReservedBranch } = useBranchStore2(); - const [urgentNotice, setUrgentNotice] = useState<{ title: string; content: string } | null>(null); + const [urgentNotice, setUrgentNotice] = useState<{ + title: string; + content: string; + } | null>(null); const [currentSlide, setCurrentSlide] = useState(1); const totalSlides = 2; @@ -34,7 +37,6 @@ const BranchInfo: React.FC = () => { const { urgentNoticeTitle, urgentNoticeContent } = router.query; - const branchOfficeRef = useRef(null); useEffect(() => { @@ -52,7 +54,10 @@ 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]; @@ -60,7 +65,9 @@ const BranchInfo: React.FC = () => { const branchImage1 = getBranchImage(selectedImagePair[0]); const branchImage2 = getBranchImage(selectedImagePair[1]); - const numericBranchId = Array.isArray(branchId) ? parseInt(branchId[0], 10) : parseInt(branchId as string, 10); + const numericBranchId = Array.isArray(branchId) + ? parseInt(branchId[0], 10) + : parseInt(branchId as string, 10); const [activeTab, setActiveTab] = useState('meetingRoom'); @@ -70,7 +77,6 @@ const BranchInfo: React.FC = () => { const data = await getOfficeMeetingRoomCount(numericBranchId); if (data.data) { console.log(data); - console.log(data.data); } } catch (error) { console.error('Error updating selected branch:', error); @@ -82,7 +88,14 @@ const BranchInfo: React.FC = () => { }, [numericBranchId]); useEffect(() => { - if (branchName && address && branchPhoneNumber && roadFromStation && stationToBranch && numericBranchId) { + if ( + branchName && + address && + branchPhoneNumber && + roadFromStation && + stationToBranch && + numericBranchId + ) { localStorage.setItem( 'branchInfo', JSON.stringify({ @@ -91,14 +104,28 @@ const BranchInfo: React.FC = () => { branchPhoneNumber, roadFromStation, stationToBranch, - branchId: numericBranchId, + branchId: numericBranchId }) ); } - }, [branchName, address, branchPhoneNumber, roadFromStation, stationToBranch, numericBranchId]); + }, [ + branchName, + address, + branchPhoneNumber, + roadFromStation, + stationToBranch, + numericBranchId + ]); useEffect(() => { - if (!branchName || !address || !branchPhoneNumber || !roadFromStation || !stationToBranch || !branchId) { + if ( + !branchName || + !address || + !branchPhoneNumber || + !roadFromStation || + !stationToBranch || + !branchId + ) { const savedBranchInfo = localStorage.getItem('branchInfo'); if (savedBranchInfo) { const { @@ -135,7 +162,7 @@ const BranchInfo: React.FC = () => { setReservedBranch(data?.data, Date.now()); router.push({ pathname: '/reservation', - query: { tab: activeTab }, + query: { tab: activeTab } }); } } catch (error) { @@ -161,16 +188,24 @@ const BranchInfo: React.FC = () => { {branchName}
- {urgentNotice && ( + {urgentNotice && (
-
- 긴급 +
+ + 긴급 +
-

{urgentNotice.title}

- +

+ {urgentNotice.title} +

+
-

{truncateText(urgentNotice.content, 28)}

+

+ {truncateText(urgentNotice.content, 28)} +

)} {
공용 공간 리스트
- +
@@ -289,7 +328,9 @@ const BranchInfo: React.FC = () => { height={16} className="w-[40px] h-[40px] my-auto" /> -

라운지

+

+ 라운지 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

리차징룸

+

+ 리차징룸 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

무인택배

+

+ 무인택배 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

폰부스

+

+ 폰부스 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

복합기

+

+ 복합기 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

스낵바

+

+ 스낵바 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

사무용품

+

+ 사무용품 +

{ height={16} className="w-[40px] h-[40px] my-auto" /> -

무제한 커피

+

+ 무제한 커피 +

@@ -368,15 +423,20 @@ const BranchInfo: React.FC = () => {
공지사항
- +
- -
+ +