From 5e359bb0baea127475d2de9c0db388c16aadb6ea Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 14 May 2025 10:54:16 +0900 Subject: [PATCH] fix: update API host URL and S3 base URL in environment files; refactor useRefFiles hook to utilize environment variables for API endpoints --- .env.development | 4 ++-- .env.production | 2 +- qcast3.database.sqlite | Bin 16384 -> 16384 bytes src/hooks/common/useRefFiles.js | 16 +++++++++------- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.env.development b/.env.development index 1ca922e7..e6e38032 100644 --- a/.env.development +++ b/.env.development @@ -2,7 +2,7 @@ NEXT_PUBLIC_API_SERVER_PATH="http://1.248.227.176:38080" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" -NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:5000" +NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:3000" SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" @@ -24,4 +24,4 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="http://files.hanasys.jp.s3-website-ap-northeast-1.amazonaws.com" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file diff --git a/.env.production b/.env.production index 3842b041..b2d50cdd 100644 --- a/.env.production +++ b/.env.production @@ -18,4 +18,4 @@ AWS_REGION="ap-northeast-2" AMPLIFY_BUCKET="interplug" AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="https://interplug.s3.ap-northeast-2.amazonaws.com" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file diff --git a/qcast3.database.sqlite b/qcast3.database.sqlite index 166f2da26bfaf6d977a400c5ef8dd5a21ef49896..6a7a809a38f22f297032357b29759527ebbd7c22 100644 GIT binary patch delta 170 zcmZo@U~Fh$oFL6;K2gS*(R^dVe0^SNUIqpRM*bZP{5$yLHuD&`^4F(|u`!5pHaeTe zh_f+7NP{_=riP{#86_nJ#a8f<)OEL^&H}O-#%zCm*#p5-lyr$xlqt&#f#j%+bxsPtVuODoCBY-QE)b D->Vyv diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index 3be7fff2..94f7a8df 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -89,7 +89,7 @@ export function useRefFiles() { setPopSpinnerStore(true) console.log('πŸš€ ~ handleFileDelete ~ handleFileDelete:', refImage) console.log('πŸš€ ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) - await del({ url: `http://localhost:3000/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` }) + await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` }) // setRefImage(null) setCurrentBgImage(null) // setCurrentCanvasPlan((prev) => ({ ...prev, bgImageName: null })) @@ -112,7 +112,7 @@ export function useRefFiles() { confirmFn: async () => { console.log('πŸš€ ~ handleAddressDelete ~ handleAddressDelete:', refImage) console.log('πŸš€ ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) - await del({ url: `http://localhost:3000/api/image/map?fileName=${currentCanvasPlan.bgImageName}` }) + await del({ url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` }) setMapPositionAddress('') setCurrentBgImage(null) // setCurrentCanvasPlan((prev) => ({ ...prev, mapPositionAddress: null })) @@ -147,7 +147,7 @@ export function useRefFiles() { // url: `${process.env.NEXT_PUBLIC_HOST_URL}/map/convert?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, // }) const res = await get({ - url: `http://localhost:3000/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, + url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, }) console.log('πŸš€ ~ handleMapImageDown ~ res:', res) // setCurrentBgImage(`${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`) @@ -211,12 +211,13 @@ export function useRefFiles() { // data: formData, // }) const res = await post({ - url: `http://localhost:3000/api/image/upload`, + url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/upload`, data: formData, }) console.log('πŸš€ ~ handleUploadImageRefFile ~ res:', res) // setCurrentBgImage(`${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`) - setCurrentBgImage(`${res.filePath}`) + // setCurrentBgImage(`${res.filePath}`) + setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) setRefImage(file) const params = { @@ -244,12 +245,13 @@ export function useRefFiles() { /** μΊλ“œ 도면 파일 μ—…λ‘œλ“œ */ const result = await post({ - url: `http://localhost:3000/api/image/cad`, + url: `${process.env.NEXT_PUBLIC_API_HOST_URL}/api/image/cad`, data: res, }) console.log('πŸš€ ~ handleUploadConvertRefFile ~ result:', result) - setCurrentBgImage(`${result.filePath}`) + // setCurrentBgImage(`${result.filePath}`) + setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) setRefImage(file) const params = {