CP TsLint small changes
This commit is contained in:
parent
fc1c96552d
commit
b88b3da9e0
@ -10,7 +10,7 @@ export class JwtInterceptor implements HttpInterceptor {
|
||||
|
||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
// add authorization header with jwt token if available
|
||||
let currentUser = this._authService.currentUserValue;
|
||||
const currentUser = this._authService.currentUserValue;
|
||||
if (currentUser && currentUser.token) {
|
||||
request = request.clone({
|
||||
setHeaders: {
|
||||
|
||||
@ -38,7 +38,7 @@ export class AuthenticationService {
|
||||
// store user details and jwt token in local storage to keep user logged in between page refreshes
|
||||
localStorage.setItem('currentUser', JSON.stringify(user));
|
||||
this.currentUserSubject.next(user);
|
||||
console.log('This is USER = ',user)
|
||||
console.log('This is USER = ', user );
|
||||
return user;
|
||||
}));
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ const routes: Routes =
|
||||
]
|
||||
},
|
||||
{ path: '**', component: NotFoundComponent}
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -12,15 +12,15 @@ import { first } from 'rxjs/operators';
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent implements OnInit{
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'MyControlPanel';
|
||||
|
||||
items : MenuItem[];
|
||||
items: MenuItem[];
|
||||
|
||||
public Connected : boolean = false;
|
||||
public DisplayLoginModal: boolean = false;
|
||||
public DisplaySignInModal: boolean = false;
|
||||
public DisplayPersonalField: boolean = false;
|
||||
public Connected = false;
|
||||
public DisplayLoginModal = false;
|
||||
public DisplaySignInModal = false;
|
||||
public DisplayPersonalField = false;
|
||||
|
||||
// Login
|
||||
public Username: string = null;
|
||||
@ -33,9 +33,9 @@ export class AppComponent implements OnInit{
|
||||
private _translateService: TranslateService,
|
||||
private _authService: AuthenticationService,
|
||||
private _router: Router
|
||||
){}
|
||||
) {}
|
||||
|
||||
ngOnInit(){
|
||||
ngOnInit() {
|
||||
this.items = [
|
||||
{label: 'Update', icon: 'pi pi-refresh'},
|
||||
{label: 'Delete', icon: 'pi pi-times'}
|
||||
@ -43,7 +43,7 @@ export class AppComponent implements OnInit{
|
||||
// To Include in a fonction of a dropdown language chose
|
||||
this._translateService.setDefaultLang('fr');
|
||||
|
||||
let currentUser = this._authService.currentUserValue;
|
||||
const currentUser = this._authService.currentUserValue;
|
||||
console.log(currentUser);
|
||||
|
||||
if (currentUser && currentUser.token) {
|
||||
@ -58,8 +58,7 @@ export class AppComponent implements OnInit{
|
||||
}
|
||||
|
||||
|
||||
public LogIn()
|
||||
{
|
||||
public LogIn() {
|
||||
/*this._appService.GetToken(this.Username, this.Password)
|
||||
.subscribe(res => {
|
||||
console.log(res.Token);
|
||||
@ -101,8 +100,7 @@ export class AppComponent implements OnInit{
|
||||
this._authService.IsLoggedIn = false;
|
||||
this._router.navigate(['/home']);
|
||||
}
|
||||
public SignUp()
|
||||
{
|
||||
public SignUp() {
|
||||
this.DisplaySignInModal = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@ import { AppService } from './_services/app.service';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CalendarModule } from 'primeng/calendar';
|
||||
|
||||
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
|
||||
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
import { AuthenticationService } from './_services/authentication.service';
|
||||
import { ConfigComponent } from './control-panel/profile/config/config.component';
|
||||
import { NotFoundComponent } from './control-panel/not-found/not-found.component';
|
||||
@ -37,15 +37,15 @@ import { ErrorInterceptor } from './_helpers/error.interceptor';
|
||||
|
||||
export function initApiConfiguration(config: ApiConfiguration): Function {
|
||||
return () => {
|
||||
config.rootUrl='https://localhost:5001'; // None = same rooturl
|
||||
config.rootUrl = 'https://localhost:5001'; // None = same rooturl
|
||||
};
|
||||
}
|
||||
|
||||
export const INIT_API_CONFIGURATION: Provider = {
|
||||
provide:APP_INITIALIZER,
|
||||
useFactory:initApiConfiguration,
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: initApiConfiguration,
|
||||
deps: [ApiConfiguration],
|
||||
multi:true
|
||||
multi: true
|
||||
};
|
||||
|
||||
// AoT requires an exported function for factories
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user