organized types into one place

This commit is contained in:
2026-03-02 14:08:01 -08:00
parent 15b82360bf
commit 328a44043f
15 changed files with 67 additions and 40 deletions
@@ -1,7 +1,7 @@
import { Component, inject, signal } from '@angular/core';
import { StudentCard } from '../student-card/student-card';
import { StudentService } from '../../../../shared/services/student.service';
import { StudentCardDto } from '../../../../shared/models/dto/student-card.dto';
import { StudentService } from '../../../../shared/services/dummy-student.service';
import { StudentCardDto } from '../../../../shared/classes/student-card.dto';
export type DisplayMode = 'card' | 'list';
@@ -25,6 +25,8 @@ export class StudentCardList {
protected readonly students = signal<StudentCardDto[]>([]);
protected readonly displayMode = signal<DisplayMode>('card');
public errorMessage = signal<String | null>(null);
// ************************** Properties ***************************
// ************************ Public Methods *************************
@@ -41,8 +43,17 @@ export class StudentCardList {
// Loads students from the service and populates the students signal.
// *****************************************************************
private loadStudents() {
this.studentService.getStudentCards().subscribe(data => {
this.students.set(data);
this.studentService.getStudentCards().then(data => {
if(!data.success)
{
this.errorMessage.set(data.message);
}
else
{
this.students.set(data.payload || [])
}
});
}
}
@@ -1,6 +1,6 @@
import { Component, input } from '@angular/core';
import { DatePipe } from '@angular/common';
import { StudentCardDto } from '../../../../shared/models/dto/student-card.dto';
import { StudentCardDto } from '../../../../shared/classes/student-card.dto';
@Component({
selector: 'app-student-card',