-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathcard.service.ts
More file actions
31 lines (29 loc) · 867 Bytes
/
card.service.ts
File metadata and controls
31 lines (29 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Injectable } from '@angular/core';
import { CityStore } from '../data-access/city.store';
import {
randomCity,
randStudent,
randTeacher,
} from '../data-access/fake-http.service';
import { StudentStore } from '../data-access/student.store';
import { TeacherStore } from '../data-access/teacher.store';
import { CardType } from '../model/card.model';
@Injectable({
providedIn: 'root',
})
export class CardService {
constructor(
private teacherStore: TeacherStore,
private studentStore: StudentStore,
private cityStore: CityStore,
) {}
addOne(type: CardType) {
if (type === CardType.TEACHER) {
this.teacherStore.addOne(randTeacher());
} else if (type === CardType.STUDENT) {
this.studentStore.addOne(randStudent());
} else if (type === CardType.CITY) {
this.cityStore.addOne(randomCity());
}
}
}