DEV Community

rorykilpatrick
rorykilpatrick

Posted on

This code is in angular 13 what is the equivalent in angular 9

The following code is in angular 13 and i need it to work in angular 9 but "HttpContext, HttpContextToken" aren't available does anyone know how to do in angular 9 ?

`import {InjectionToken} from "@angular/core";
import {Observable} from "rxjs";
import {AuthConfig} from "angular-oauth2-oidc";
import {HttpContext, HttpContextToken} from '@angular/common/http';

export enum JWTHeaderEnum {
NONE,
JWT,
AUTHORIZATION,
}

export const AUTH_TOKEN_HEADER = new HttpContextToken(() => JWTHeaderEnum.JWT);

export const HTTPCONTEXT_KONG_ENDPOINT = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.AUTHORIZATION);
export const HTTPCONTEXT_APIGEE_ENDPOINT = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.JWT);
export const HTTPCONTEXT_NO_AUTH = new HttpContext().set(AUTH_TOKEN_HEADER, JWTHeaderEnum.NONE);
`

Top comments (0)