Created
February 21, 2016 13:50
-
-
Save srph/38f67a10e991b6cb2d83 to your computer and use it in GitHub Desktop.
Revisions
-
srph created this gist
Feb 21, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ import axios from 'axios'; // You can use any cookie library or whatever // library to access your client storage. import cookie from 'cookie-machine'; axios.interceptors.request.use(function(config) { const token = cookie.get(__TOKEN_KEY__); if ( token != null ) { config.headers.Authorization = `Bearer ${token}`; } return config; }, function(err) { return Promise.reject(err); });