Skip to content

Commit

Permalink
Refactor : 배포 환경 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ncb6206 committed Jan 19, 2024
1 parent f994d3d commit 43c37aa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pnpm-debug.log*
lerna-debug.log*

.env
.env.production
.eslintcache
node_modules
dist
Expand Down
48 changes: 26 additions & 22 deletions src/service/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@ export const GET = async ({ type, pagesize, currentpage }: IPageParams) => {
const actSize = pagesize ?? 0;
const actPage = currentpage ?? 0;

// const response = await instance.get(`/v1/search/shop.json`, {
// params: {
// query: '신발',
// display: actSize,
// start: actPage,
// sort: 'sim',
// filter: 'medium',
// },
// headers: {
// 'X-Naver-Client-Id': import.meta.env.VITE_NAVER_CLIENT_ID,
// 'X-Naver-Client-Secret': import.meta.env.VITE_NAVER_CLIENT_SECRET,
// },
// });
let response;

const response = await instance.get(import.meta.env.VITE_PROXY_URL, {
params: {
query: '신발',
display: actSize,
start: actPage,
sort: 'sim',
filter: 'medium',
},
});
if (import.meta.env.DEV) {
response = await instance.get(`/v1/search/shop.json`, {
params: {
query: '신발',
display: actSize,
start: actPage,
sort: 'sim',
filter: 'medium',
},
headers: {
'X-Naver-Client-Id': import.meta.env.VITE_NAVER_CLIENT_ID,
'X-Naver-Client-Secret': import.meta.env.VITE_NAVER_CLIENT_SECRET,
},
});
} else {
response = await instance.get(import.meta.env.VITE_PROXY_URL, {
params: {
query: '신발',
display: actSize,
start: actPage,
sort: 'sim',
filter: 'medium',
},
});
}

if (type === 'length') return response.data.items.length;

Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
},
plugins: [react()],
base: '/',
// esbuild: {
// drop: ['console', 'debugger'],
// },
esbuild: {
drop: ['console', 'debugger'],
},
});

0 comments on commit 43c37aa

Please sign in to comment.