Skip to content

Commit a862fb3

Browse files
authored
Merge pull request #126 from Moaguide-develop/feat/productpage
Feat/productpage
2 parents 89470be + a59a156 commit a862fb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+160
-230
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ WORKDIR /app
2525
ARG NEXT_PUBLIC_MAP_KEY
2626
ARG NEXT_PUBLIC_BACKEND_URL
2727
ARG NEXT_PUBLIC_GOOGLE_ANALYTICS
28-
28+
ARG NEXT_PUBLIC_NAVER_ANALYTICS
2929

3030

3131

src/app/mypage/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ const Mypage = () => {
1616
const [loading, setLoading] = useState(true);
1717

1818
const fetchBookmarks = async () => {
19-
const { data } = await axiosInstance.get('https://api.moaguide.com/user/bookmark');
19+
const { data } = await axiosInstance.get('/user/bookmark');
2020
return data;
2121
};
2222

23-
const {
24-
data: bookmarks,
25-
} = useQuery({ queryKey: ['bookmarks'], queryFn: fetchBookmarks });
23+
const { data: bookmarks } = useQuery({
24+
queryKey: ['bookmarks'],
25+
queryFn: fetchBookmarks
26+
});
2627

2728
useEffect(() => {
2829
if (!isLoggedIn) {
@@ -62,14 +63,13 @@ const Mypage = () => {
6263
<nav>
6364
<MypageMenu />
6465
</nav>
65-
<div
66+
<div
6667
className="text-gray400 body7 cursor-pointer max-w-max w-full mx-auto mt-10 pb-4 hover:underline"
67-
onClick={handleLogout}
68-
>
68+
onClick={handleLogout}>
6969
<span className="max-w-max mb-[40px] sm:mb-0">로그아웃</span>
7070
</div>
7171
</div>
7272
);
7373
};
7474

75-
export default Mypage;
75+
export default Mypage;

src/components/product/Bookmark.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const Bookmark = ({ content, totalPages, pageNumber }: IProductBuildingProps) =>
4141
};
4242

4343
const fetchBookmarks = async () => {
44-
const { data } = await axiosInstance.get('https://api.moaguide.com/user/bookmark');
44+
const { data } = await axiosInstance.get(`/user/bookmark`);
4545
return data;
4646
};
4747

src/components/product/contentlist/ProductDealContentList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const ProductDealContentList = ({
109109

110110
<div className=" flex ">
111111
<div className=" ml-[4px] mr-[4px] text-gray-500 ">
112-
{item.price.toLocaleString()}
112+
{item?.price?.toLocaleString()}
113113
</div>
114114
<div
115115
className={`mr-[16px] ${
@@ -131,7 +131,7 @@ const ProductDealContentList = ({
131131

132132
<div className=" flex flex-col">
133133
<div className="w-[108px] mr-[16px] text-gray-500 desk:hidden md:flex ">
134-
{item.price.toLocaleString()}
134+
{item?.price?.toLocaleString()}
135135
</div>
136136
<div
137137
className={`w-[88px] mr-[16px] desk:hidden md:flex ${
@@ -152,7 +152,7 @@ const ProductDealContentList = ({
152152
</div>
153153

154154
<div className=" w-[140px] mr-[28px] text-gray-500 desk:hidden md:flex ">
155-
{item.totalPrice.toLocaleString()}
155+
{item?.totalPrice?.toLocaleString()}
156156
</div>
157157
<div
158158
className={`w-[61px] desk2:mr-[29px] desk:mr-[0px] rounded-lg flex justify-center items-center desk:ml-auto px-2 ${

src/components/product/detail/News.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default News;
4949

5050
const NewsItem = ({ title, date, id, category, link, imgUrl }: INewsItem) => {
5151
const fetchData = async ({ id }: { id: number }) => {
52-
const response = await axiosInstance.post(`https://api.moaguide.com/news/view/${id}`);
52+
const response = await axiosInstance.post(`/news/view/${id}`);
5353
return response.data;
5454
};
5555

src/components/product/detail/building/Map.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useRef } from 'react';
22
import { useQuery } from '@tanstack/react-query';
3-
import axios from 'axios';
43
import { usePathname } from 'next/navigation';
4+
import { basicAxiosInstance } from '@/service/axiosInstance';
55

66
declare global {
77
interface Window {
@@ -13,9 +13,7 @@ const KakaoMap = () => {
1313
const pathname = usePathname();
1414
const lastSegment = pathname.split('/').pop(); // 경로의 마지막 부분 추출
1515
const fetchBuildingData = async () => {
16-
const response = await axios.get(
17-
`https://api.moaguide.com/detail/building/area/${lastSegment}`
18-
);
16+
const response = await basicAxiosInstance.get(`/detail/building/area/${lastSegment}`);
1917
return response.data;
2018
};
2119
const mapRef = useRef<HTMLDivElement>(null);

src/components/product/detail/building/PublicTransport.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React, { useState } from 'react';
2-
import axios from 'axios';
32
import { useQuery } from '@tanstack/react-query';
43
import { usePathname } from 'next/navigation';
54
import Image from 'next/image';
5+
import { basicAxiosInstance } from '@/service/axiosInstance';
66
interface NearSubway {
77
station: string;
88
route: string[];
@@ -61,8 +61,8 @@ const PublicTransport = () => {
6161
const [Ismodal, setIsModal] = useState(false);
6262
const fetchData = async () => {
6363
try {
64-
const response = await axios.get(
65-
`https://api.moaguide.com/detail/building/sub/${lastSegment}`
64+
const response = await basicAxiosInstance.get(
65+
`/detail/building/sub/${lastSegment}`
6666
);
6767
return response.data;
6868
} catch (error) {

src/components/product/detail/building/chart/AccommodationRateChart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React, { useState, useRef, useEffect } from 'react';
1+
import React, { useState } from 'react';
22
import { useQuery } from '@tanstack/react-query';
3-
import axios from 'axios';
43
import { usePathname } from 'next/navigation';
54
import { IStayRateData } from '@/types/BuildingProductType';
65
import { Chart } from 'react-chartjs-2';
76
import { TooltipItem } from 'chart.js';
7+
import { basicAxiosInstance } from '@/service/axiosInstance';
88

99
const AccommoationRateChart = () => {
1010
const pathname = usePathname();
@@ -13,8 +13,8 @@ const AccommoationRateChart = () => {
1313
const [endYear, setEndYear] = useState<number>(2024);
1414
const fetchData = async () => {
1515
try {
16-
const response = await axios.get<IStayRateData>(
17-
`https://api.moaguide.com/detail/building/stay/rate/${lastSegment}?syear=${startYear}&eyear=${endYear}`
16+
const response = await basicAxiosInstance.get<IStayRateData>(
17+
`/detail/building/stay/rate/${lastSegment}?syear=${startYear}&eyear=${endYear}`
1818
);
1919
return response.data;
2020
} catch (error) {

src/components/product/detail/building/chart/AccommodationVisitorsChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React, { useState } from 'react';
22
import { Bar } from 'react-chartjs-2';
33
import { useQuery } from '@tanstack/react-query';
4-
import axios from 'axios';
54
import { usePathname } from 'next/navigation';
65
import { IStayDayData } from '@/types/BuildingProductType';
76
import { TooltipItem } from 'chart.js';
7+
import { basicAxiosInstance } from '@/service/axiosInstance';
88

99
const AccommodationVisitorsChart = () => {
1010
const pathname = usePathname();
1111
const lastSegment = pathname.split('/').pop(); // 경로의 마지막 부분 추출
1212
const [startYear, setStartYear] = useState<number>(2022);
1313
const [endYear, setEndYear] = useState<number>(2024);
1414
const fetchData = async () => {
15-
const response = await axios.get<IStayDayData>(
16-
`https://api.moaguide.com/detail/building/stay/day/${lastSegment}?syear=${startYear}&eyear=${endYear}`
15+
const response = await basicAxiosInstance.get<IStayDayData>(
16+
`/detail/building/stay/day/${lastSegment}?syear=${startYear}&eyear=${endYear}`
1717
);
1818
return response.data;
1919
};

src/components/product/detail/building/chart/CommercialRentChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useQuery } from '@tanstack/react-query';
2-
import axios from 'axios';
32
import { Line } from 'react-chartjs-2';
43
import { useState, useEffect } from 'react';
54
import { usePathname } from 'next/navigation';
5+
import { basicAxiosInstance } from '@/service/axiosInstance';
66

77
interface RentData {
88
year: number;
@@ -40,8 +40,8 @@ const CommercialRentChart = ({ rentType }: { rentType: boolean | undefined }) =>
4040
}, [rentType, setBuildingType]);
4141

4242
const fetchData = async () => {
43-
const response = await axios.get<ApiResponse>(
44-
`https://api.moaguide.com/detail/building/rentrate/${lastSegment}?type=${buildingType}&syear=${startYear}&eyear=${endYear}`
43+
const response = await basicAxiosInstance.get<ApiResponse>(
44+
`/detail/building/rentrate/${lastSegment}?type=${buildingType}&syear=${startYear}&eyear=${endYear}`
4545
);
4646
return response.data;
4747
};

src/components/product/detail/building/chart/CommercialVacancyRateChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useQuery } from '@tanstack/react-query';
2-
import axios from 'axios';
32
import { Bar } from 'react-chartjs-2';
43
import { ChartOptions } from 'chart.js';
54

65
import { useState, useEffect } from 'react';
76
import { usePathname } from 'next/navigation';
7+
import { basicAxiosInstance } from '@/service/axiosInstance';
88

99
interface RentData {
1010
year: number;
@@ -41,8 +41,8 @@ const CommercialVacancyRateChart = ({ rentType }: { rentType: boolean | undefine
4141
}, [rentType, setBuildingType]);
4242

4343
const fetchData = async () => {
44-
const response = await axios.get<ApiResponse>(
45-
`https://api.moaguide.com/detail/building/vacancyrate/${lastSegment}?type=${buildingType}&syear=${startYear}&eyear=${endYear}`
44+
const response = await basicAxiosInstance.get<ApiResponse>(
45+
`/detail/building/vacancyrate/${lastSegment}?type=${buildingType}&syear=${startYear}&eyear=${endYear}`
4646
);
4747
return response.data;
4848
};

src/components/product/detail/building/chart/CopyrightFeeChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useState } from 'react';
22
import { Chart } from 'react-chartjs-2';
33
import { usePathname } from 'next/navigation';
4-
import axios from 'axios';
54
import { IMusicCopyRightFeeChart } from '@/types/MusicProductType';
65
import { useQuery } from '@tanstack/react-query';
6+
import { basicAxiosInstance } from '@/service/axiosInstance';
77

88
const BuildingCopyRightFeeChart = () => {
99
const pathname = usePathname();
@@ -12,8 +12,8 @@ const BuildingCopyRightFeeChart = () => {
1212

1313
const fetchData = async () => {
1414
try {
15-
const response = await axios.get<IMusicCopyRightFeeChart>(
16-
`https://api.moaguide.com/detail/divide/${lastSegment}?month=${filteringData}`
15+
const response = await basicAxiosInstance.get<IMusicCopyRightFeeChart>(
16+
`/detail/divide/${lastSegment}?month=${filteringData}`
1717
);
1818
return response.data;
1919
} catch (error) {

src/components/product/detail/building/chart/FloatingPopulationChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react';
22
import { Bar } from 'react-chartjs-2';
33
import { useQuery } from '@tanstack/react-query';
4-
import axios from 'axios';
54
import { usePathname } from 'next/navigation';
65
import { ISubwayData } from '@/types/BuildingProductType';
6+
import { basicAxiosInstance } from '@/service/axiosInstance';
77

88
const FloatingPopulationChart = () => {
99
const pathname = usePathname();
1010
const lastSegment = pathname.split('/').pop(); // 경로의 마지막 부분 추출
1111

1212
const fetchData = async () => {
13-
const response = await axios.get<ISubwayData>(
14-
`https://api.moaguide.com/detail/building/subway/${lastSegment}?year=2023&month=12`
13+
const response = await basicAxiosInstance.get<ISubwayData>(
14+
`/detail/building/subway/${lastSegment}?year=2023&month=12`
1515
);
1616
return response.data;
1717
};

src/components/product/detail/building/chart/OfficialPriceChart.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useState, useRef, useEffect } from 'react';
22
import { useQuery } from '@tanstack/react-query';
33
import { Line } from 'react-chartjs-2';
4-
import axios from 'axios';
54
import { usePathname } from 'next/navigation';
65
import { ChartOptions } from 'chart.js';
6+
import { basicAxiosInstance } from '@/service/axiosInstance';
77

88
// API 데이터 타입 정의
99
interface LandData {
@@ -37,9 +37,7 @@ const OfficialPriceChart = () => {
3737

3838
// API에서 데이터를 가져오는 함수
3939
const fetchData = async (): Promise<ApiData> => {
40-
const response = await axios.get(
41-
`https://api.moaguide.com/detail/building/land/${lastSegment}`
42-
);
40+
const response = await basicAxiosInstance.get(`/detail/building/land/${lastSegment}`);
4341
return response.data;
4442
};
4543

src/components/product/detail/building/chart/PopulationInformationChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import React from 'react';
22
import { Bar } from 'react-chartjs-2';
33
import { usePathname } from 'next/navigation';
4-
import axios from 'axios';
54
import { useQuery } from '@tanstack/react-query';
65
import { TooltipItem } from 'chart.js';
6+
import { basicAxiosInstance } from '@/service/axiosInstance';
77

88
const PopulationInformationChart = () => {
99
const pathname = usePathname();
1010
const lastSegment = pathname.split('/').pop(); // 경로의 마지막 부분 추출
1111

1212
const fetchData = async () => {
13-
const response = await axios.get(
14-
`https://api.moaguide.com/detail/building/population/${lastSegment}`
13+
const response = await basicAxiosInstance.get(
14+
`/detail/building/population/${lastSegment}`
1515
);
1616
return response.data;
1717
};

src/components/product/detail/building/chart/StockPriceChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useRef, useState } from 'react';
22
import { Line } from 'react-chartjs-2';
3-
import axios from 'axios';
43
import { useQuery } from '@tanstack/react-query';
54
import { usePathname } from 'next/navigation';
65
import { IMusicBulidingStockPriceChart } from '@/types/MusicProductType';
6+
import { basicAxiosInstance } from '@/service/axiosInstance';
77

88
const BuildingStockPriceChart = () => {
99
const chartRef = useRef(null);
@@ -13,8 +13,8 @@ const BuildingStockPriceChart = () => {
1313

1414
const fetchData = async () => {
1515
try {
16-
const response = await axios.get<IMusicBulidingStockPriceChart>(
17-
`https://api.moaguide.com/detail/transaction/${lastSegment}?month=${filteringData}`
16+
const response = await basicAxiosInstance.get<IMusicBulidingStockPriceChart>(
17+
`/detail/transaction/${lastSegment}?month=${filteringData}`
1818
);
1919
return response.data;
2020
} catch (error) {

src/components/product/detail/content/ContentProductDetail.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import axios from 'axios';
21
import MovieChart from './MovieChart';
32
import MovieContent from './MovieContent';
43
import MovieStats from './MovieStats';
54
import MovieTenChart from './MovieTenChart';
65
import Schedule from './Schedule';
76
import { usePathname } from 'next/navigation';
87
import { useQuery } from '@tanstack/react-query';
8+
import { basicAxiosInstance } from '@/service/axiosInstance';
99

1010
const ContentProductDetail = ({
1111
url,
@@ -20,9 +20,7 @@ const ContentProductDetail = ({
2020
const lastSegment = pathname.split('/').pop(); // 경로의 마지막 부분 추출
2121

2222
const fetchData = async () => {
23-
const response = await axios.get(
24-
`https://api.moaguide.com/detail/content/sub/${lastSegment}`
25-
);
23+
const response = await basicAxiosInstance.get(`/detail/content/sub/${lastSegment}`);
2624
return response.data;
2725
};
2826

src/components/product/detail/content/MovieChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { IContentMovieCharts } from '@/types/ContentProductType';
22
import { useQuery } from '@tanstack/react-query';
3-
import axios from 'axios';
43
import { usePathname } from 'next/navigation';
54
import { Line } from 'react-chartjs-2';
65
import {
@@ -16,6 +15,7 @@ import {
1615
} from 'chart.js';
1716
import ChartDataLabels from 'chartjs-plugin-datalabels';
1817
import { useRef, useState } from 'react';
18+
import { basicAxiosInstance } from '@/service/axiosInstance';
1919

2020
ChartJS.register(
2121
CategoryScale,
@@ -47,8 +47,8 @@ const MovieChart = () => {
4747
};
4848

4949
const fetchData = async () => {
50-
const response = await axios.get<IContentMovieCharts>(
51-
`https://api.moaguide.com/detail/content/${filteringData}/${lastSegment}`
50+
const response = await basicAxiosInstance.get<IContentMovieCharts>(
51+
`/detail/content/${filteringData}/${lastSegment}`
5252
);
5353
return response.data;
5454
};

0 commit comments

Comments
 (0)