Chore: Check for deprecations using eslint plugin

Chore: environment file replacement stopped.
Chore: All components are now standalone and removed all modules
Chore: App routing is now in app.routes and similarly for all submodules
Chore: Http interceptors are now functional and split refresh interceptor into a separate one.
This commit is contained in:
2024-05-31 22:54:41 +05:30
parent b6bb3dbcfd
commit 4571b31fc0
309 changed files with 3897 additions and 5222 deletions
@@ -1,6 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserDetailComponent } from './user-detail.component';
@@ -8,14 +6,11 @@ describe('UserDetailComponent', () => {
let component: UserDetailComponent;
let fixture: ComponentFixture<UserDetailComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ReactiveFormsModule, RouterTestingModule],
declarations: [UserDetailComponent],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [UserDetailComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
@@ -1,6 +1,13 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { FormArray, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { MatButton } from '@angular/material/button';
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent, MatCardActions } from '@angular/material/card';
import { MatCheckbox } from '@angular/material/checkbox';
import { MatDialog } from '@angular/material/dialog';
import { MatDivider } from '@angular/material/divider';
import { MatFormField, MatLabel, MatSuffix } from '@angular/material/form-field';
import { MatIcon } from '@angular/material/icon';
import { MatInput } from '@angular/material/input';
import { ActivatedRoute, Router } from '@angular/router';
import { ToasterService } from '../../core/toaster.service';
@@ -12,6 +19,23 @@ import { UserService } from '../user.service';
selector: 'app-user-detail',
templateUrl: './user-detail.component.html',
styleUrls: ['./user-detail.component.css'],
standalone: true,
imports: [
MatCard,
MatCardHeader,
MatCardTitle,
MatCardContent,
ReactiveFormsModule,
MatFormField,
MatLabel,
MatInput,
MatIcon,
MatSuffix,
MatCheckbox,
MatDivider,
MatCardActions,
MatButton,
],
})
export class UserDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
@@ -78,38 +102,38 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
save() {
if (this.route.snapshot.paramMap.get('id') === 'me') {
this.ser.updateMe(this.getItem()).subscribe(
() => {
this.ser.updateMe(this.getItem()).subscribe({
next: () => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/');
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
} else {
this.ser.saveOrUpdate(this.getItem()).subscribe(
() => {
this.ser.saveOrUpdate(this.getItem()).subscribe({
next: () => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
}
delete() {
this.ser.delete(this.item.id as string).subscribe(
() => {
this.ser.delete(this.item.id as string).subscribe({
next: () => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
error: (error) => {
this.toaster.show('Danger', error);
},
);
});
}
confirmDelete(): void {