Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Add 'X-Cerberus-Client' header to HTTP calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sdford committed Aug 7, 2017
1 parent 3f009e5 commit 8b9c933
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import axios from 'axios'
import * as appActions from '../../actions/appActions'
import Login from '../Login/Login'
import Modal from '../Modal/Modal'
import Header from '../Header/Header'
Expand All @@ -20,13 +22,25 @@ import './App.scss'
userName: state.auth.userName,
displayUserContextMenu: state.header.displayUserContextMenu,
vaultToken: state.auth.vaultToken,
modalStack: state.modal.modalStack
modalStack: state.modal.modalStack,
hasDashboardMetadataLoaded: state.app.metadata.hasLoaded,
dashboardVersion: state.app.metadata.version
}
})


export default class App extends Component {

componentDidMount() {
if (! this.props.hasDashboardMetadataLoaded) {
this.props.dispatch(appActions.loadDashboardMetadata())
}
}

render() {
const {isAdmin, userName, displayUserContextMenu, dispatch, vaultToken, modalStack, children, isSessionExpired, isAuthenticated} = this.props
const {isAdmin, userName, displayUserContextMenu, dispatch, vaultToken, modalStack, children, isSessionExpired, isAuthenticated, dashboardVersion} = this.props

axios.defaults.headers.common['X-Cerberus-Client'] = `Dashboard/${dashboardVersion}`

return (
<div id='main-wrapper'>
Expand Down Expand Up @@ -59,4 +73,4 @@ export default class App extends Component {
</div>
)
}
}
}

0 comments on commit 8b9c933

Please sign in to comment.