-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a context to hold application config data. This is to replace configuration.ts as it was creating issues. Vaigly references #21.
- Loading branch information
1 parent
7e73d8c
commit 97e8b6b
Showing
5 changed files
with
29 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
NODE_ENV= | ||
|
||
APP_PORT= | ||
APP_PREFIX= | ||
|
||
API_ROOT= | ||
REACT_APP_API_ROOT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import PrimaryView from './components/PrimaryView/PrimaryView'; | ||
import * as dotenv from 'dotenv'; | ||
|
||
import React, { FC } from 'react'; | ||
import { Container } from '@mui/material'; | ||
|
||
const environment = process.env.NODE_ENV; | ||
const envFilePath = !environment ? '.env' : `.env.${environment}`; | ||
dotenv.config({ path: envFilePath }); | ||
|
||
const App: FC<{}> = () => { | ||
return ( | ||
<div className="App"> | ||
<PrimaryView /> | ||
</div> | ||
); | ||
return <Container className="App"></Container>; | ||
}; | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { createContext } from 'react'; | ||
|
||
const configuration = { | ||
api: { | ||
root: process.env.REACT_APP_API_ROOT || '', | ||
}, | ||
}; | ||
const configurationContext = createContext(configuration); | ||
|
||
const ConfigurationContext = () => { | ||
return ( | ||
<configurationContext.Provider | ||
value={configuration} | ||
></configurationContext.Provider> | ||
); | ||
}; | ||
|
||
export { configurationContext }; | ||
export default ConfigurationContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters