Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
Merge pull request #65 from djenriquez/fix/standby-sys-health
Browse files Browse the repository at this point in the history
Add exception for sys/health 429 resp
  • Loading branch information
djenriquez authored Mar 3, 2017
2 parents bd9622c + 395b75f commit 638dcb2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
18 changes: 17 additions & 1 deletion app/components/shared/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ import FontIcon from 'material-ui/FontIcon';
import { browserHistory } from 'react-router';
import CountDown from './countdown.js'
import styles from './header.css';
import { callVaultApi } from '../../shared/VaultUtils.jsx'
import { callVaultApi } from '../../shared/VaultUtils.jsx';
import Snackbar from 'material-ui/Snackbar';


var logout = () => {
window.localStorage.removeItem('vaultAccessToken');
browserHistory.push('/login');
}

function snackBarMessage(message) {
let ev = new CustomEvent("snackbar", { detail: { message: message } });
document.dispatchEvent(ev);
}

class Header extends React.Component {
constructor(props) {
super(props);
Expand All @@ -33,6 +40,15 @@ class Header extends React.Component {
this.setState({
version: resp.data.version,
});
})
.catch((error) => {
if (error.response.status === 429) {
this.setState({
version: error.response.data.version,
});
} else {
snackBarMessage(error);
}
});
}

Expand Down
13 changes: 0 additions & 13 deletions src/health.js

This file was deleted.

4 changes: 1 addition & 3 deletions src/vaultapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ exports.callMethod = function (req, res) {
headers: req.headers,
data: req.body
}
//console.log(config);

axios.request(config)
.then(function (resp) {
res.json(resp.data);
})
.catch(function (err) {
//console.error(err.response.data);
//console.error(err.stack);
res.status(err.response.status).send(err.response.data);
});
};

0 comments on commit 638dcb2

Please sign in to comment.