Skip to content

Commit

Permalink
Merge pull request #66 from craig-cogdill/fix/KibanaError
Browse files Browse the repository at this point in the history
Handle no matches for JWT more elegantly
  • Loading branch information
craig-cogdill authored Sep 14, 2016
2 parents bd1a317 + bbf1414 commit f2dbb02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ define(function (require) {
var hrefUrl = window.location.href;
var jwtPattern = /jwt=(.*?)(&|$)/i;
var jwt = String(hrefUrl).match(jwtPattern);
localStorage.setItem('token', jwt[1]);
if (jwt && jwt.length > 0) {
localStorage.setItem('token', jwt[1]);
}
RestangularProvider.addFullRequestInterceptor(function() {
const config = { headers: {} };
const token = localStorage.getItem('token');
Expand Down

0 comments on commit f2dbb02

Please sign in to comment.