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 characters
| import { OnInit, Injectable } from "@angular/core"; | |
| import { Observable } from "rxjs/Observable"; | |
| import { | |
| HttpClient, | |
| HttpHeaders, | |
| HttpErrorResponse | |
| } from "@angular/common/http"; | |
| import { environment } from "../../../../environments/environment"; | |
| import { tap, catchError } from "rxjs/operators"; | |
| import { ErrorObservable } from "rxjs/observable/ErrorObservable"; |
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 characters
| providers: [ | |
| CandidateService, | |
| NotificationService, | |
| UserLoginService, | |
| UserRegistrationService, | |
| LoggedInUserService, | |
| TemplateCategoryService, | |
| ResumeGeneratorService, | |
| {provide: HTTP_INTERCEPTORS, useClass: AddTokenInterceptor, multi:true}, |
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 characters
| import { HttpInterceptor, HttpSentEvent, HttpHeaderResponse, HttpHandler, HttpEvent, HttpRequest, HttpHeaders, HttpClient, HttpErrorResponse } from "@angular/common/http"; | |
| import { Observable } from "rxjs/Observable"; | |
| import { Injectable } from "@angular/core"; | |
| import { environment } from "../../../environments/environment"; | |
| import { tap, catchError } from "rxjs/operators"; | |
| import { ErrorObservable } from "rxjs/observable/ErrorObservable"; | |
| @Injectable() | |
| export class AddTokenInterceptor implements HttpInterceptor { |
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 characters
| app.MapWhen( context => context.Request.Query.ContainsKey("querypath1"), (appbuilder) => | |
| { | |
| appbuilder.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("-- Map when -- querypath1 - Middleware One</br>"); | |
| }); | |
| }); |
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 characters
| app.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("Middleware One</br>"); | |
| await next.Invoke(); | |
| }); | |
| app.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("Middleware Two</br>"); | |
| await next.Invoke(); |
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 characters
| app.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("Middleware One</br>"); | |
| await next.Invoke(); | |
| }); | |
| app.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("Middleware Two</br>"); | |
| await next.Invoke(); |
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 characters
| app.Use(async (context, next) => | |
| { | |
| await context.Response.WriteAsync("Middleware One"); | |
| await next.Invoke(); | |
| }); |
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 characters
| public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
| { | |
| app.UseCors("AllowAll"); | |
| app.UseExceptionHandlingMiddleware(); | |
| app.UseMvc(); | |
| //app.UseExceptionHandler(appbuilder => | |
| //{ | |
| // appbuilder.Run(async context => |
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 characters
| using Microsoft.AspNetCore.Builder; | |
| namespace thetalentbot.JobSeeker.Exceptions | |
| { | |
| public static class ExceptionHandlerMiddleware | |
| { | |
| public static IApplicationBuilder UseExceptionHandlingMiddleware(this IApplicationBuilder builder) | |
| { | |
| return builder.UseMiddleware<ExceptionHandler>(); | |
| } |
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 characters
| using System; | |
| using System.Net; | |
| using System.Threading.Tasks; | |
| using Newtonsoft.Json; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Hosting; | |
| namespace thetalentbot.JobSeeker.Exceptions | |
| { | |
| public class ExceptionHandler |