- Added Tailwind CSS dependencies and configured PostCSS. - Updated app component to wrap router outlet with a styled div for dark mode support. - Modified routing to include a default route and added auth guards. - Implemented dark mode toggle functionality in content component. - Enhanced login component with improved styling and lifecycle management. - Created items component with basic structure and routing. - Added global styles for body and dark mode variants. - Updated tests for new items component.
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { JsonPipe } from '@angular/common';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { Component, OnInit, signal } from '@angular/core';
|
|
import { OAuthService } from 'angular-oauth2-oidc';
|
|
import { AppConfigService } from '../services/config.service';
|
|
import { RouterLink, RouterOutlet } from "@angular/router";
|
|
import { setTheme } from '../app';
|
|
|
|
@Component({
|
|
selector: 'app-content',
|
|
imports: [JsonPipe, RouterOutlet, RouterLink],
|
|
templateUrl: './content.html',
|
|
styleUrl: './content.scss'
|
|
})
|
|
export class Content implements OnInit {
|
|
data = signal({});
|
|
|
|
constructor(httpClient: HttpClient, readonly as: OAuthService, readonly cs: AppConfigService) {
|
|
httpClient.get('/api/product')
|
|
.subscribe(data => {
|
|
this.data.set(data);
|
|
});
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
setTheme();
|
|
}
|
|
|
|
toggleMode() {
|
|
sessionStorage.getItem('isDarkMode') === 'true' ?
|
|
sessionStorage.setItem('isDarkMode', 'false') : sessionStorage.setItem('isDarkMode', 'true');
|
|
setTheme();
|
|
}
|
|
}
|
|
|
|
|