mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 13:27:35 +00:00
organized types into one place
This commit is contained in:
+15
-4
@@ -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
-1
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user