File tree Expand file tree Collapse file tree 8 files changed +34
-4
lines changed Expand file tree Collapse file tree 8 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 1- REACT_APP_BASE_API_URL = " http ://localhost:8080 /api/v1"
1+ REACT_APP_BASE_API_URL = https ://appserver.zenml.io /api/v1
22REACT_APP_HUB_API_URL = " https://hubapi.zenml.io"
33REACT_APP_VERSION = $npm_package_version
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ interface TAction {
3535interface TServerInfo {
3636 id : string ;
3737 version : string ;
38+ debug : boolean ;
3839 deploymentType : string ;
3940 databaseType : string ;
4041 secretsStoreType : string ;
Original file line number Diff line number Diff line change 113113 "eslint-plugin-prettier" : " ^3.1.4" ,
114114 "eslint-plugin-react" : " ^7.20.5" ,
115115 "eslint-plugin-redux-saga" : " ^1.1.3" ,
116+ "husky" : " ^8.0.0" ,
116117 "postcss" : " ^8.4.16" ,
117118 "prettier" : " ^2.0.5" ,
118119 "react-hooks-testing-library" : " ^0.6.0" ,
119- "react-test-renderer" : " ^16.13.1" ,
120- "husky" : " ^8.0.0"
120+ "react-test-renderer" : " ^16.13.1"
121121 },
122122 "engines" : {
123123 "npm" : " >=6.14.17" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Provider } from 'react-redux';
44import { RouteConfig } from './routes' ;
55
66import configureStore from './redux/setup/storeSetup' ;
7+ import './utils/axios' ;
78import Toaster from './ui/layouts/common/Toaster' ;
89
910import 'bootstrap/dist/css/bootstrap-grid.min.css' ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export interface State {
66 deploymentType : string ;
77 databaseType : string ;
88 secretsStoreType : string ;
9+ debug : boolean ;
910}
1011
1112interface Payload {
@@ -14,6 +15,7 @@ interface Payload {
1415 deployment_type : string ;
1516 database_type : string ;
1617 secrets_store_type : string ;
18+ debug : boolean ;
1719}
1820
1921export type Action = {
@@ -27,6 +29,7 @@ export const initialState: State = {
2729 id : '' ,
2830 secretsStoreType : '' ,
2931 version : '' ,
32+ debug : false ,
3033} ;
3134
3235const newState = ( info : Payload ) : State => ( {
@@ -35,6 +38,7 @@ const newState = (info: Payload): State => ({
3538 id : info . id ,
3639 secretsStoreType : info . secrets_store_type ,
3740 version : info . version ,
41+ debug : info . debug ,
3842} ) ;
3943
4044export default function serverInfoReducer (
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ export const enhancers = getComposeWithEnhancers()(
2525 applyMiddleware ( sagaMiddleware , logger ) ,
2626) ;
2727
28+ export const store = createStore ( persistedReducer , enhancers ) ;
2829export default function configureStore ( ) : any {
29- const store = createStore ( persistedReducer , enhancers ) ;
3030 sagaMiddleware . run ( rootSaga ) ;
3131
3232 window . addEventListener (
Original file line number Diff line number Diff line change 1+ import axios from 'axios' ;
2+ import { getServerInfoFromRedux } from './store' ;
3+
4+ const axiosInterceptor = axios . interceptors . request . use ( function ( config ) {
5+ if ( config . url ?. includes ( process . env . REACT_APP_BASE_API_URL as string ) ) {
6+ config . headers [ 'Source-Context' ] = 'dashboard' ;
7+ }
8+
9+ if ( config . url ?. includes ( process . env . REACT_APP_HUB_API_URL as string ) ) {
10+ const serverInfo = getServerInfoFromRedux ( ) ;
11+ const debugFlag = serverInfo . debug ;
12+ config . headers [ 'Source-Context' ] = 'dashboard' ;
13+ config . headers [ 'Debug-Context' ] = debugFlag || false ;
14+ }
15+
16+ return config ;
17+ } ) ;
18+
19+ export default axiosInterceptor ;
Original file line number Diff line number Diff line change 1+ import { store } from '../redux/setup/storeSetup' ;
2+
3+ export function getServerInfoFromRedux ( ) : TServerInfo {
4+ return ( store . getState ( ) || { } ) . persisted ?. serverInfo || { } ;
5+ }
You can’t perform that action at this time.
0 commit comments