Add documentation to interceptors.

This commit is contained in:
Spencer Ofwiti
2021-05-12 09:16:38 +03:00
parent 208c448984
commit 508c1b5c94
33 changed files with 726 additions and 401 deletions

View File

@@ -60,6 +60,13 @@
<code>src/app/_interceptors/http-config.interceptor.ts</code>
</p>
<p class="comment">
<h3>Description</h3>
</p>
<p class="comment">
<p>Intercepts and handles setting of configurations to outgoing HTTP request. </p>
</p>
<section>
@@ -101,10 +108,16 @@
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="6" class="link-to-prism">src/app/_interceptors/http-config.interceptor.ts:6</a></div>
<div class="io-line">Defined in <a href="" data-line="10" class="link-to-prism">src/app/_interceptors/http-config.interceptor.ts:10</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Initialization of http config interceptor. </p>
</div>
</td>
</tr>
</tbody>
</table>
</section>
@@ -136,14 +149,16 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="9"
class="link-to-prism">src/app/_interceptors/http-config.interceptor.ts:9</a></div>
<div class="io-line">Defined in <a href="" data-line="21"
class="link-to-prism">src/app/_interceptors/http-config.interceptor.ts:21</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Intercepts HTTP requests.</p>
</div>
<div class="io-description">
<b>Parameters :</b>
@@ -153,6 +168,7 @@
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
@@ -167,6 +183,12 @@
</td>
<td>
<ul>
<li>An outgoing HTTP request with an optional typed body.</li>
</ul>
</td>
</tr>
<tr>
<td>next</td>
@@ -179,6 +201,12 @@
</td>
<td>
<ul>
<li>The next HTTP handler or the outgoing request dispatcher.</li>
</ul>
</td>
</tr>
</tbody>
</table>
@@ -190,7 +218,8 @@
</div>
<div class="io-description">
<p>The forwarded request.</p>
</div>
</td>
</tr>
@@ -202,14 +231,25 @@
<div class="tab-pane fade tab-source-code" id="c-source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable } from &#x27;@angular/core&#x27;;
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from &#x27;@angular/common/http&#x27;;
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from &#x27;@angular/common/http&#x27;;
import { Injectable } from &#x27;@angular/core&#x27;;
// Third party imports
import { Observable } from &#x27;rxjs&#x27;;
/** Intercepts and handles setting of configurations to outgoing HTTP request. */
@Injectable()
export class HttpConfigInterceptor implements HttpInterceptor {
/** Initialization of http config interceptor. */
constructor() {}
/**
* Intercepts HTTP requests.
*
* @param request - An outgoing HTTP request with an optional typed body.
* @param next - The next HTTP handler or the outgoing request dispatcher.
* @returns The forwarded request.
*/
intercept(request: HttpRequest&lt;unknown&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;unknown&gt;&gt; {
// const token: string &#x3D; sessionStorage.getItem(btoa(&#x27;CICADA_SESSION_TOKEN&#x27;));