Skip to content

Commit 4a6c88f

Browse files
authored
Merge branch 'develop' into chore-clicelee/shadcn
2 parents 0d46c73 + aaa3173 commit 4a6c88f

21 files changed

+63
-86
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# 실시간 이슈를 나눕니다. [키워드 랭킹 커뮤니티, 잇픽](https://itpick.netlify.app)
1+
# 실시간 이슈를 나눕니다, [키워드 랭킹 커뮤니티, 잇픽](https://itpick.netlify.app)
22

33
<img width="788" alt="Screenshot 2024-09-06 at 4 43 43 PM" src="https://github.com/user-attachments/assets/0a16aff3-ec98-45a8-b854-174f5860080d">

public/_redirects

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/auth/* https://itpick.store/auth/:splat 200
2-
/user/* https://itpick.store/user/:splat 200
3-
/keyword/search* https://itpick.store/keyword/search:splat 200
4-
/keyword* https://itpick.store/keyword:splat 200
5-
/rank/main-keywords https://itpick.store/rank/main-keywords 200
6-
/rank/reference* https://itpick.store/rank/reference:splat 200
7-
/rank* https://itpick.store/rank:splat 200
8-
/debate https://itpick.store/debate 200
9-
/debate/* https://itpick.store/debate/:splat 200
1+
/api/* https://itpick.store/:splat 200
2+
103
/* /index.html 200

src/apis/WriteDebate/getDebateDetails.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const getDebateDetails = async (debateId: number) => {
1212
console.log(token);
1313

1414
try {
15-
const response = await axios.get(`/debate/details`, {
15+
const response = await axios.get(`/api/debate/details`, {
1616
headers: {
1717
'Authorization': `Bearer ${token}`, // Authorization 헤더에 토큰 추가
1818
},

src/apis/emailDuplicateCheck.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
export const emailDuplicateCheck = async (email: string) => {
4-
const response = await axios.get(`/auth/email/check`, {
4+
const response = await axios.get(`/api/auth/email/check`, {
55
params: {
66
email: encodeURIComponent(email),
77
},

src/apis/getAlarm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axios from "axios";
33
export const getAlarm = async() => {
44
const token = localStorage.getItem("accessToken");
55
try{
6-
const response = await axios.get(`/user/alarm`,{
6+
const response = await axios.get(`/api/user/alarm`,{
77
headers: {
88
"Authorization": `Bearer ${token}`,
99
}

src/apis/getCommunityRankingKeyword.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import axios from 'axios';
22

33
export const getCommunityRankingKeyword = async () => {
44
try {
5-
const response = await axios.get('/rank/main-keywords', {
6-
7-
});
5+
const response = await axios.get('/api/rank/main-keywords', {});
86

97
return response.data.result;
108
} catch (error) {
119
console.error('홈 커뮤니티 별 랭킹 키워드 불러오는 중 오류 발생:', error);
1210
throw error;
1311
}
14-
};
12+
};

src/apis/getEmailVerification.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from "axios";
22

33
export const getEmailVerficiation = async (email: string, verificationCode: string) => {
4-
const response = await axios.get(`/auth/emails/verifications`, {
4+
const response = await axios.get(`/api/auth/emails/verifications`, {
55
params: {
66
email: email,
77
code: verificationCode,

src/apis/getInvolvedDebate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const getInvolvedDebate = async() => {
55

66
try {
77
const response = await axios.get(
8-
`/user/involved-debate`,
8+
`/api/user/involved-debate`,
99
{
1010
headers: {
1111
'Content-Type': 'application/json',

src/apis/getKeyword.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from "axios";
22

33
export const getKeyword = async(query: string) => {
44
const response = await axios.get(
5-
`/keyword/search`,
5+
`/api/keyword/search`,
66
{params: {
77
query
88
}}

src/apis/getKeywordById.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from "axios";
22

33
// 키워드 ID로 키워드 이름을 불러오는 함수
44
export const getKeywordById = async (keywordId: number) => {
5-
const response = await axios.get(`/keyword`, {
5+
const response = await axios.get(`/api/keyword`, {
66
params: {
77
keywordId: keywordId,
88
},

src/apis/getKeywordRelatedData.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ interface Response {
1717
result: KeywordResult;
1818
}
1919

20-
export const getKeywordRelatedData = async (community: string, period: string, keyword: string) => {
20+
export const getKeywordRelatedData = async (
21+
community: string,
22+
period: string,
23+
keyword: string
24+
) => {
2125
try {
22-
const response = await axios.get<Response>('/rank/reference', {
26+
const response = await axios.get<Response>('/api/rank/reference', {
2327
params: {
2428
community: community,
2529
period: period,
@@ -34,4 +38,4 @@ export const getKeywordRelatedData = async (community: string, period: string, k
3438
console.error('키워드 관련자료 데이터를 가져오는 중 오류 발생:', error);
3539
throw error;
3640
}
37-
};
41+
};

src/apis/getLiveDiscussionBest3.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from 'axios';
22

33
export const getLiveDiscussionBest3 = async () => {
44
const response = await axios.get(
5-
`debate/trend`,
5+
`api/debate/trend`,
66
)
77
return response.data.result;
88
}

src/apis/getMyDebate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const getMyDebate = async() => {
55

66
try {
77
const response = await axios.get(
8-
`/user/my-debate`,
8+
`/api/user/my-debate`,
99
{
1010
headers: {
1111
'Content-Type': 'application/json',

src/apis/getMyPageUserInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const getMyPageUserInfo = async () => {
44
try {
55
const token = localStorage.getItem('accessToken');
66

7-
const response = await axios.get('/user/my-page', {
7+
const response = await axios.get('/api/user/my-page', {
88
headers: {
99
'Authorization': `Bearer ${token}`,
1010
},

src/apis/getProfileEditPageUserInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const getProfileEditUserInfo = async () => {
44
try {
55
const token = localStorage.getItem('accessToken');
66

7-
const response = await axios.get('/user/profile-edit', {
7+
const response = await axios.get('/api/user/profile-edit', {
88
headers: {
99
'Authorization': `Bearer ${token}`,
1010
},

src/apis/getRankingInfo.ts

+24-19
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ interface Response {
2222
result: RankingResult;
2323
}
2424

25-
26-
export const getRankingInfo = async (community: string, period: string, date: string) => {
25+
export const getRankingInfo = async (
26+
community: string,
27+
period: string,
28+
date: string
29+
) => {
2730
try {
28-
const response = await axios.get<Response>('/rank', {
31+
const response = await axios.get<Response>('/api/rank', {
2932
params: {
3033
community: community,
3134
period: period,
@@ -35,25 +38,27 @@ export const getRankingInfo = async (community: string, period: string, date: st
3538

3639
console.log('랭킹 API 응답 데이터 확인', response.data);
3740

38-
const rankingList = response.data.result.rankingList.map((item: RankingItem) => {
39-
const tags = [
40-
item.nateRank !== -1 ? `네이트 ${item.nateRank}등` : '',
41-
item.naverRank !== -1 ? `네이버 ${item.naverRank}등` : '',
42-
item.zumRank !== -1 ? `줌 ${item.zumRank}등` : '',
43-
item.googleRank !== -1 ? `구글 ${item.googleRank}등` : '',
44-
item.namuwikiRank !== -1 ? `나무위키 ${item.namuwikiRank}등` : ''
45-
].filter(tag => tag !== ''); // 빈 문자열 제거
46-
47-
return {
48-
rank: item.rank,
49-
name: item.keyword,
50-
tags: tags
51-
};
52-
});
41+
const rankingList = response.data.result.rankingList.map(
42+
(item: RankingItem) => {
43+
const tags = [
44+
item.nateRank !== -1 ? `네이트 ${item.nateRank}등` : '',
45+
item.naverRank !== -1 ? `네이버 ${item.naverRank}등` : '',
46+
item.zumRank !== -1 ? `줌 ${item.zumRank}등` : '',
47+
item.googleRank !== -1 ? `구글 ${item.googleRank}등` : '',
48+
item.namuwikiRank !== -1 ? `나무위키 ${item.namuwikiRank}등` : '',
49+
].filter((tag) => tag !== ''); // 빈 문자열 제거
50+
51+
return {
52+
rank: item.rank,
53+
name: item.keyword,
54+
tags: tags,
55+
};
56+
}
57+
);
5358

5459
return rankingList;
5560
} catch (error) {
5661
console.error('랭킹 조회 중 오류:', error);
5762
throw error;
5863
}
59-
};
64+
};

src/apis/getRecentDiscussion.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const getRecentDiscussion = async () => {
44
try {
55
const token = localStorage.getItem('accessToken');
66

7-
const response = await axios.get(`debate/recent`, {
7+
const response = await axios.get(`/api/debate/recent`, {
88
headers: {
99
'Authorization': `Bearer ${token}`,
1010
},

src/apis/getUserNickname.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const getUserNickname = async () => {
44
try {
55
const token = localStorage.getItem('accessToken');
66

7-
const response = await axios.get('/user/nickname', {
7+
const response = await axios.get('/api/user/nickname', {
88
headers: {
99
'Authorization': `Bearer ${token}`,
1010
},

src/apis/loginUser.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import axios from 'axios';
22

33
export const loginUser = async (email: string, password: string) => {
44
try {
5-
const response = await axios.post('/auth/login', {
6-
email, // encodeURIComponent 제거
7-
password, // encodeURIComponent 제거
5+
const response = await axios.post('/api/auth/login', {
6+
email, // encodeURIComponent 제거
7+
password, // encodeURIComponent 제거
88
});
99

1010
return response.data;
1111
} catch (error) {
12-
console.log("로그인 실패:",error);
12+
console.log('로그인 실패:', error);
1313
return null; //로그인 실패시 null 반환
14-
// throw error;
14+
// throw error;
1515
}
1616
};

src/apis/nicknameDuplicateCheck.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
export const nicknameDuplicateCheck = async (nickname: string) => {
4-
const response = await axios.get(`/auth/nickname/check`, {
4+
const response = await axios.get(`/api/auth/nickname/check`, {
55
params: {
66
nickname: nickname,
77
},

vite.config.ts

+8-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react-swc'
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react-swc';
33
import mkcert from 'vite-plugin-mkcert';
44

55
// https://vitejs.dev/config/
@@ -16,48 +16,25 @@ export default defineConfig({
1616
'@images': '/src/assets/images',
1717
'@components': '/src/components',
1818
'@utils': '/src/utils',
19-
'@apis': '/src/apis',
19+
'@apis': '/src/apis',
2020
'@pages': '/src/pages',
2121
'@store': '/src/store',
2222
'@hooks': '/src/hooks',
23-
}
23+
},
2424
},
2525
server: {
2626
https: {
2727
key: 'cert/localhost-key.pem',
2828
cert: 'cert/localhost.pem',
2929
},
3030
proxy: {
31-
'/auth': {
32-
target: 'https://itpick.store',
33-
changeOrigin: true,
34-
secure: false,
35-
rewrite: (path) => path.replace(/^\/auth/, '/auth')
36-
},
37-
'/user': {
38-
target: 'https://itpick.store',
39-
changeOrigin: true,
40-
secure: false,
41-
rewrite: (path) => path.replace(/^\/user/, '/user')
42-
},
43-
'/rank': {
44-
target: 'https://itpick.store',
45-
changeOrigin: true,
46-
secure: false,
47-
rewrite: (path) => path.replace(/^\/rank/, '/rank')
48-
},
49-
'/keyword': {
50-
target: 'https://itpick.store',
51-
changeOrigin: true,
52-
secure: false,
53-
rewrite: (path) => path.replace(/^\/keyword/, '/keyword')
54-
},
55-
'/debate': {
31+
'/api': {
5632
target: 'https://itpick.store',
5733
changeOrigin: true,
34+
// '/api' 제거
35+
rewrite: (path) => path.replace(/^\/api/, ''),
5836
secure: false,
59-
rewrite: (path) => path.replace(/^\/debate/, '/debate')
6037
},
6138
},
6239
},
63-
})
40+
});

0 commit comments

Comments
 (0)