diff --git a/frontend/Dockerfile b/frontend/Dockerfile index c3c211e5c..9fcff3caa 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /frontend COPY package.json . RUN npm install COPY . . -ENTRYPOINT npm start +ENTRYPOINT npm dev FROM dev AS prod RUN npm install -g serve diff --git a/frontend/package.json b/frontend/package.json index d75d7bd93..b18c57236 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,7 @@ "build:js": "vite build --emptyOutDir", "watch:js": "vite", "watch:codegen": "graphql-codegen --config codegen.yml --watch", - "start": "npm-run-all codegen -p watch:*", + "dev": "npm-run-all codegen -p watch:*", "build": "npm-run-all codegen -p build:*", "lint": "eslint ./**/* --fix --ext .jsx --ext .tsx --ext .scss", "prod": "serve -s build -p 3000" diff --git a/frontend/src/graphql/client.ts b/frontend/src/graphql/client.ts index 32360e6df..89bf2fee0 100644 --- a/frontend/src/graphql/client.ts +++ b/frontend/src/graphql/client.ts @@ -2,7 +2,7 @@ import { ApolloClient, HttpLink } from '@apollo/client'; import { cache } from './cache'; const httpLink = new HttpLink({ - uri: '/api/graphql' + uri: import.meta.env.PROD ? '/api/graphql' : 'https://staging.berkeleytime.com/api/graphql' }); // Explore ways to transform API responses before reaching the components diff --git a/frontend/src/redux/actions.js b/frontend/src/redux/actions.js index 4b5822e70..be51dfc1c 100644 --- a/frontend/src/redux/actions.js +++ b/frontend/src/redux/actions.js @@ -16,6 +16,8 @@ import { UPDATE_ENROLL_SELECTED } from './actionTypes'; +axios.defaults.baseURL = import.meta.env.PROD ? axios.defaults.baseURL : 'https://staging.berkeleytime.com'; + // update grade list const updateGradeContext = (data) => ({ type: UPDATE_GRADE_CONTEXT,