Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
fix(frontend): use only one server URL env var
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Sep 9, 2021
1 parent 1ffb1e2 commit 896157b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# The URL where the server runs
REACT_APP_SERVER_URL="http://localhost:3000"

# The URL where the Apollo server runs
REACT_APP_GRAPHQL_URL="http://localhost:3000/graphql"
REACT_APP_SERVER_URL="http://localhost:3000"
2 changes: 1 addition & 1 deletion frontend/src/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const mergeByReplacement: { merge: FieldMergeFunction } = {

export const apolloClient = new ApolloClient({
link: new HttpLink({
uri: process.env.REACT_APP_GRAPHQL_URL,
uri: `${process.env.REACT_APP_SERVER_URL?.replace(/\/$/, '')}/graphql`,
credentials: 'include',
}),
cache: new InMemoryCache({
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/UserProfileContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, FunctionComponent, useEffect, useState } from 'react'

const SERVER_URL = process.env.REACT_APP_SERVER_URL
const SERVER_URL = process.env.REACT_APP_SERVER_URL?.replace(/\/$/, '')

export interface UserProfile {
id: number
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/useAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const AuthContext = createContext<AuthInfo>({

export const useAuth = () => useContext(AuthContext)

const SERVER_URL = process.env.REACT_APP_SERVER_URL
const SERVER_URL = process.env.REACT_APP_SERVER_URL?.replace(/\/$/, '')

const headers = {
'content-type': 'application/json; charset=utf-8',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/shipments/DownloadCSVMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props {
shipment: ShipmentQuery['shipment']
}

const SERVER_URL = process.env.REACT_APP_SERVER_URL
const SERVER_URL = process.env.REACT_APP_SERVER_URL?.replace(/\/$/, '')

const DownloadCSVMenu: FunctionComponent<Props> = ({ shipment }) => {
const [modalIsVisible, showModal, hideModal] = useModalState()
Expand Down

0 comments on commit 896157b

Please sign in to comment.