We updated from Angular 12 to Angular 15 version 1018.157.0
We updated to this version as recommend by cumulocity team to resolve some issues, and got fixed
Revert the update is not option for us
LoginService
import { LocationStrategy } from '@angular/common'
import { Injectable, Injector } from '@angular/core'
import {
IAuthentication,
ICredentials,
IUserInventoryRole,
IFetchOptions,
} from '@c8y/client'
import {
AlertService,
AppStateService,
LoginService,
TenantUiService
} from '@c8y/ngx-components'
import { ApiService, BasicAuth, CookieAuth, FetchClient, Realtime, TenantLoginOptionsService, TenantService, UserService } from '@c8y/ngx-components/api'
import { TranslateService } from '@ngx-translate/core'
import * as _ from 'lodash'
@Injectable({
providedIn: 'root',
})
export class CustomLoginService extends LoginService {
static ROLE_SYNCHRONIZED: string = 'roleSynchronized'
constructor(
injector : Injector,
client : FetchClient,
basicauth : BasicAuth,
cookieAuth: CookieAuth,
public app: AppStateService,
public userService: UserService,
tenant: TenantService,
realtime: Realtime,
public alertService: AlertService,
api: ApiService,
tenantUiService : TenantUiService,
tenantLoginOptionsService : TenantLoginOptionsService,
translateService : TranslateService,
location: LocationStrategy,
) {
super(
injector,
client,
basicauth,
cookieAuth,
app,
userService,
tenant,
realtime,
alertService,
api,
tenantUiService,
tenantLoginOptionsService,
translateService,
location,
)
}
async login(
auth?: IAuthentication,
credentials?: ICredentials,
): Promise<void> {
await super.login(auth, credentials)
try {
const currentUser = this.app.currentUser.value
const currentTenant = this.app.currentTenant.value
if (currentUser) {
let userDetails = {
username: currentUser.userName,
tenantId: currentTenant.name,
}
const options: IFetchOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(userDetails),
}
//Calling microserve
let url = `service/blim-ms-role-sync/sync`
this.createHttpRequest(url, options);
}
}
catch {
//TODO: Remove this log.
console.log("Unable to sync role.")
}
}
createHttpRequest(url: string, options: IFetchOptions): Promise<Response> {
const client = new FetchClient();
return client.fetch(url, options);
}
}
Deprecation of the Microservice SDK for C#?