diff --git a/.gitignore b/.gitignore index 3b0b4037..95fbd9d2 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ dist-ssr *.sln *.sw? -.env \ No newline at end of file +.env +.env.development +.env.production diff --git a/package.json b/package.json index 11950df6..577fdf64 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,9 @@ "private": true, "version": "0.0.0", "type": "module", - "proxy": "http://localhost:8080", "scripts": { - "dev": "vite", - "build": "tsc && vite build", + "dev": "vite --mode development", + "build": "tsc && vite build --mode production", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "test": "jest", diff --git a/src/apis/axios/axios.ts b/src/apis/axios/axios.ts index 31b98fed..752175ef 100644 --- a/src/apis/axios/axios.ts +++ b/src/apis/axios/axios.ts @@ -1,7 +1,7 @@ import { ACCESS_TOKEN } from "@/constants/localStorageKey"; import axios, { AxiosResponse } from "axios"; -const BASE_URL = "http://localhost:8080/api"; +const BASE_URL = `${import.meta.env.VITE_API_URL}/api`; const instanceConfig = { baseURL: BASE_URL, diff --git a/src/apis/postPaymentSuccess.ts b/src/apis/postPaymentSuccess.ts index ff844c22..19ca76a6 100644 --- a/src/apis/postPaymentSuccess.ts +++ b/src/apis/postPaymentSuccess.ts @@ -21,7 +21,7 @@ const postPaymentSuccess = async ({ }; await instance - .post("http://localhost:8080/api/payment/toss/success", body, { + .post(`${import.meta.env.VITE_API_URL}/api/payment/toss/success`, body, { headers: { Authorization: encryptedSecretKey, }, diff --git a/src/components/LogIn/GithubLoginButton/GithubLoginButton.tsx b/src/components/LogIn/GithubLoginButton/GithubLoginButton.tsx index 8eb9f61c..b18dedd2 100644 --- a/src/components/LogIn/GithubLoginButton/GithubLoginButton.tsx +++ b/src/components/LogIn/GithubLoginButton/GithubLoginButton.tsx @@ -2,8 +2,9 @@ import githubLogo from "@/assets/icon/github-mark.svg"; import Button from "@/components/LogIn/Button/Button"; function GithubLoginButton() { - const GITHUB_REDIRECT_URI = - "http://localhost:8080/oauth2/authorization/github"; + const GITHUB_REDIRECT_URI = `${ + import.meta.env.VITE_API_URL + }/oauth2/authorization/github`; const onClick = () => { window.location.href = GITHUB_REDIRECT_URI; diff --git a/src/setupProxy.js b/src/setupProxy.js deleted file mode 100644 index a47e3211..00000000 --- a/src/setupProxy.js +++ /dev/null @@ -1,11 +0,0 @@ -import { createProxyMiddleware } from "http-proxy-middleware"; - -export default (app) => { - app.use( - "/api", - createProxyMiddleware({ - target: "http://localhost:8080", - changeOrigin: true, - }) - ); -};