Skip to content

Commit

Permalink
#patch install dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtom94 committed Nov 20, 2023
1 parent 03c7e2a commit 14d2b71
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .env-development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NODE_ENV=development
BACKEND_BASE_URL=https://api.themoviedb.org
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-to-scaleway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

- run: npm run build
env:
BACKEND_BASE_URL: ''
BACKEND_BASE_URL: 'https://api.themoviedb.org'
STATIC_FILES_URL: 'https://reacteasyssrjckf9fbl-reacteasyssrstatic.functions.fnc.fr-par.scw.cloud'

- name: Copy past client static files
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ it's gonna use the `.nvmrc` file with v16.20.0

### Start in dev mode

Get prepared with the env vars

```sh
cp .env-development .env
```

```npm
npm install
```
Expand Down
19 changes: 18 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"compression-webpack-plugin": "^10.0.0",
"core-js": "^3.25.3",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"global": "^4.4.0",
"isomorphic-fetch": "^3.0.0",
Expand Down
7 changes: 1 addition & 6 deletions src/store/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@ const movies = (state = INITIAL_STATE_MOVIES, action: ActionDispatch) => {
}
case ActionTypes.MOVIES.SUCCESS:
delete copyState.error
// eslint-disable-next-line no-case-declarations
let data: unknown = []
if (action.body.dispatchKind === 'GET_MOVIES') {
data = action.response?.results
}
return {
...copyState,
isLoading: false,
data
...(action.body.dispatchKind === 'GET_MOVIES' && { data: action.response.results })
}
case ActionTypes.MOVIES.FAILURE:
return {
Expand Down
5 changes: 2 additions & 3 deletions webpack/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require('dotenv').config()

module.exports = (env) => {
process.env.BACKEND_BASE_URL = 'https://api.themoviedb.org'
if (typeof env !== 'undefined' && env === 'development') {
process.env.NODE_ENV = 'development'
return [require('./webpack.client.dev'), require('./webpack.server.dev')]
}
process.env.NODE_ENV = 'production'
return [require('./webpack.client.prod'), require('./webpack.server.prod')]
}

0 comments on commit 14d2b71

Please sign in to comment.