Skip to content

Commit

Permalink
Merge 155114c into ca37ea2
Browse files Browse the repository at this point in the history
  • Loading branch information
judeinno committed Mar 7, 2019
2 parents ca37ea2 + 155114c commit a52a8cd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
- Clone the forked repository to your computer ensure to run the command below in the directory you want to store the project.
# git clone [the url of the repository] For example;
# git clone https://github.com/yourusername/openmrs-ocl-client.git
# Create a .env file in the root directory with the variables API URL and Traditional OCL URL as shown below to access app in dev mode;
REACT_APP_OCL_API_HOST=https://api.qa.openconceptlab.org/
REACT_APP_TRADITIONAL_OCL=https://qa.openconceptlab.org
- In the root directory of the project install all the dependencies using the command below
$ npm install
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import urlConfig from '../../../config';

export const getUsername = () => localStorage.getItem('username');

export const classes = [
Expand Down Expand Up @@ -55,4 +57,4 @@ export const MAP_TYPE = {
questionAndAnswer: 'Q-AND-A',
};

export const TRADITIONAL_OCL_BASE_URL = 'https://qa.openconceptlab.org';
export const TRADITIONAL_OCL_BASE_URL = urlConfig.TRADITIONAL_OCL;
3 changes: 2 additions & 1 deletion src/config/axiosConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import axios from 'axios';
import urlConfig from './index';

const instance = axios.create({
baseURL: 'https://api.qa.openconceptlab.org/',
baseURL: urlConfig.OCL_API_HOST,
});

instance.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
Expand Down
4 changes: 4 additions & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
OCL_API_HOST: process.env.REACT_APP_OCL_API_HOST || 'https://api.qa.openconceptlab.org/',
TRADITIONAL_OCL: process.env.REACT_APP_TRADITIONAL_OCL || 'https://qa.openconceptlab.org',
};
3 changes: 2 additions & 1 deletion src/redux/actions/auth/authActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import {
login, loginFailed, loginStarted, logout,
} from './authActionCreators';
import { showNetworkError } from '../dictionaries/dictionaryActionCreators';
import urlConfig from '../../../config';

const BASE_URL = 'https://api.qa.openconceptlab.org/';
const BASE_URL = urlConfig.OCL_API_HOST;

const loginAction = ({ username, password }) => (dispatch) => {
dispatch(loginStarted());
Expand Down

0 comments on commit a52a8cd

Please sign in to comment.