Skip to content

Commit

Permalink
Merge pull request #612 from asuc-octo/dev-urls
Browse files Browse the repository at this point in the history
Use staging backend for frontend development
  • Loading branch information
mathhulk authored Sep 24, 2023
2 parents be267e4 + db4419c commit e8ea2a8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e8ea2a8

Please sign in to comment.