Skip to content

Commit

Permalink
fix: begin fixing .env var
Browse files Browse the repository at this point in the history
Idk why it doesn't work
  • Loading branch information
Zalk0 committed Nov 28, 2023
1 parent 8369e88 commit 73cdfc6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# React dotenv

NODE_ENV=development
PORT=8081
PORT=3000

# Pour désactiver l'ouverture dans un nouvel onglet
BROWSER=none
Expand All @@ -12,5 +12,5 @@ BROWSER=none
# `pnpm dev`. For values used along with `pnpm build`, check
# the Dockerfile (docker build arguments)

REACT_APP_API_URI=http://localhost:3001
REACT_APP_API_TIMEOUT=5000
NEXT_PUBLIC_API_URI=http://localhost:3001
NEXT_PUBLIC_API_TIMEOUT=5000
4 changes: 2 additions & 2 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const requestAPI = <T>(method: Method, route: string, body?: { [key: string]: un
return new Promise<AxiosResponse<T>>((resolve, reject) => {
axios
.request<T>({
baseURL: "http://localhost:3001", //TODO env
baseURL: process.env.NEXT_PUBLIC_API_URI, //TODO env
method,
headers: {
Authorization: token ? `Bearer ${token}` : undefined,
},
url: route,
data: body,
timeout: parseInt(process.env.REACT_APP_API_TIMEOUT) || 5000,
timeout: parseInt(process.env.NEXT_PUBLIC_API_TIMEOUT) || 5000,
})
.then((res) => resolve(res))
.catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let socket: ClientSocket | undefined = undefined;
export const Socket = {
connect: () => async (dispatch: Dispatch) => {
if (!socket) {
socket = io("http://localhost:3001"); //TODO env
socket = io(process.env.NEXT_PUBLIC_API_URI); //TODO env

socket.on('connect', () => dispatch(setSocketConnected()));

Expand Down

0 comments on commit 73cdfc6

Please sign in to comment.