From b27e0ea524cfd36217adfe80096db2b081144a82 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 14 Jul 2021 18:59:38 +0100 Subject: [PATCH] update base url from app settings --- actions/index.js | 13 ++++++++----- pages/searchresults.js | 2 -- pages/viewall.js | 2 -- store/store.js | 1 - 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/actions/index.js b/actions/index.js index 7bbb5fc5..ae21ac90 100644 --- a/actions/index.js +++ b/actions/index.js @@ -3,7 +3,9 @@ import https from "https"; //import {XMLHttpRequest} from 'xmlhttprequest'; process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; -let BASE_URL = "http://localhost:3000"; + +let BASE_URL; +BASE_URL = process.env.API_ROOT || "http://localhost:3000"; const agent = new https.Agent({ rejectUnauthorized: false, @@ -26,7 +28,7 @@ const crmHeaders = { export const getBasicSearch = (searchString) => { console.log("got to axios", searchString); - + console.log("api_root: ", BASE_URL); return ( axios //.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=contains(title, '" + searchString + "')&$count=true", crmHeaders) @@ -43,7 +45,7 @@ export const getBasicSearch = (searchString) => { export const getFormData = (whichForm) => { console.log("got to axios", whichForm); - + console.log("api_root: ", BASE_URL); return ( axios //.get("api/appealforms/pinswg_dns", { @@ -66,7 +68,7 @@ export const getFormData = (whichForm) => { export const getAppealsTypes = () => { console.log("got to axios: appeal types"); - + console.log("api_root: ", BASE_URL); return axios .get(BASE_URL + "/api/lookups/pinswg_appealcasetype", { httpsAgent: new https.Agent({ rejectUnauthorized: false }), @@ -161,6 +163,7 @@ export const getBasicSearch2 = (searchString) => { export const getAppealTypeDetail = (caseReference, appealcasetype) => { console.log("got to axios", searchString); + console.log("api_root: ", BASE_URL); // example appealcasetype type pinswg_householderappealhases return axios .get( @@ -180,7 +183,7 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => { export const getLPA = () => { console.log("got to axios", searchString); - + console.log("api_root: ", BASE_URL); return axios .get( "https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/accounts?$select=name", diff --git a/pages/searchresults.js b/pages/searchresults.js index 5d5aba04..744a0cf6 100644 --- a/pages/searchresults.js +++ b/pages/searchresults.js @@ -86,8 +86,6 @@ export const getServerSideProps = wrapper.getServerSideProps( // ); const mapStateToProps = (state) => { - console.log("mapstate", state); - return { search: state.search, searchResultsObj: state.searchResultsObj, diff --git a/pages/viewall.js b/pages/viewall.js index e6d1d426..53aefc6d 100644 --- a/pages/viewall.js +++ b/pages/viewall.js @@ -85,8 +85,6 @@ export const getServerSideProps = wrapper.getServerSideProps( // ); const mapStateToProps = (state) => { - console.log("mapstate", state); - return { search: state.search, searchResultsObj: state.searchResultsObj, diff --git a/store/store.js b/store/store.js index bde12cc1..1b4f9023 100644 --- a/store/store.js +++ b/store/store.js @@ -22,7 +22,6 @@ const combinedReducer = combineReducers({ const reducer = (state = { progress: "{}" }, action) => { switch (action.type) { case HYDRATE: - console.log("here", state); //if (action.payload.progress === '{}') delete action.payload.progress; return { ...state, ...action.payload }; case "SERVER_ACTION":