export default function userInterceptor($localStorage){
  function request(config){
    if(config.headers.Authorization){
      return config;
    }
    if($localStorage.token){
      config.headers.Authorization = 'bearer ' + $localStorage.token;
    }
    return config;
  }
  return {request};
}
userInterceptor.$inject = ['$localStorage'];

export default function userInterceptor(user){
  function request(config){
    if(config.headers.Authorization){
      return config;
    }
    if(user.token){
      config.headers.Authorization = 'bearer ' + user.token;
    }
    return config;
  }
  return {request};
}
userInterceptor.$inject = ['$localStorage'];

Use user service in interceptor
Use user service in interceptor
