refactor: rename components and update dialog implementations; add confirm dialog for deletion actions
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
<h1>Bonjour, {{ user.firstName }}!</h1>
|
||||
<p>Que souhaitez-vous faire ?</p>
|
||||
<br>
|
||||
<button mat-flat-button [routerLink]="'/add-product'">Ajouter un nouveau produit</button>
|
||||
<button mat-raised-button [routerLink]="'/products'">Voir la liste des produits</button>
|
||||
<div class="home-actions">
|
||||
<button mat-flat-button [routerLink]="'/products'">Voir la liste des produits</button>
|
||||
<button mat-raised-button [routerLink]="'/admin'">Gérer la base de données</button>
|
||||
</div>
|
||||
} @else {
|
||||
<h2>Gestion des produits</h2>
|
||||
<div class="home-actions">
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomeComponent } from './home.component';
|
||||
|
||||
describe('HomeComponent', () => {
|
||||
let component: HomeComponent;
|
||||
let fixture: ComponentFixture<HomeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [HomeComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(HomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,16 +1,14 @@
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {MatButton} from '@angular/material/button';
|
||||
import {AuthService} from '../../services/auth/auth.service';
|
||||
import {RouterLink} from '@angular/router';
|
||||
import {AddProductComponent} from '../add-product/add-product.component';
|
||||
import {Router, RouterLink} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatButton,
|
||||
RouterLink,
|
||||
AddProductComponent
|
||||
RouterLink
|
||||
],
|
||||
templateUrl: './home.component.html',
|
||||
styleUrl: './home.component.css'
|
||||
@@ -18,6 +16,7 @@ import {AddProductComponent} from '../add-product/add-product.component';
|
||||
export class HomeComponent {
|
||||
|
||||
protected readonly authService: AuthService = inject(AuthService);
|
||||
protected readonly router: Router = inject(Router);
|
||||
|
||||
getUser() {
|
||||
return this.authService.user();
|
||||
|
||||
Reference in New Issue
Block a user