title: How do I add a loading spinner for every request on backend Salesforce Cloud
body: <p>I would like to have some kind of interceptor or something that shows a loading spinner for every request made to the server, what I am looking is the most general form of it. I currently have a spinner component that holds the view and controller in it, but I am just wondering how do I make this general for every http request show it into the view maybe in the header or somewhere else.</p>
  
  <p>This is the view part: </p>
  
  <pre><code>&lt;aura:component &gt;
  &lt;aura:attribute name="visible" type="Boolean" default="false"/&gt;
  
  &lt;div class="{!if(v.visible, '', 'slds-hide')}"&gt;
      &lt;div class="slds-spinner_container"&gt;
          &lt;div role="status" class="slds-spinner slds-spinner_medium"&gt;
              &lt;span class="slds-assistive-text"&gt;Loading&lt;/span&gt;
              &lt;div class="slds-spinner__dot-a"&gt;&lt;/div&gt;
              &lt;div class="slds-spinner__dot-b"&gt;&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>I should somehow add to the controller some logic for other controllers to call it, but I just dont know and not quite sure what is the best way to do it!</p>
  
  <p>For ex I have some controllers that makes a call to the server and I would like to somehow automatically show the loading spinner when such actions happens:</p>
  
  <pre><code>doInit : function(component, event, helper)
  {
      var getTeamAction = component.get("c.getCurrentUserTeam");
      getTeamAction.setCallback(this, function(response) {
          if(response)
          {
              var t= response.getReturnValue();
              component.set("v.millTeamMembers", t);
          }
          else
          {
              console.log("Unable to getteam");
          }
      });
  
      $A.enqueueAction(getTeamAction);
  }
  </code></pre>