|
|
@@ -36,19 +36,26 @@ export class FamilyService {
|
|
36
|
36
|
return this.families.filter((family) => family.dankaId === dankaId);
|
|
37
|
37
|
}
|
|
38
|
38
|
|
|
39
|
|
- //家族個人の情報を取得
|
|
|
39
|
+ //家族の情報を取得
|
|
40
|
40
|
getFamilyById(id: string): Family | undefined {
|
|
41
|
41
|
return this.families.find((family) => family.id === id);
|
|
42
|
42
|
}
|
|
43
|
43
|
|
|
|
44
|
+ //家族の情報を更新
|
|
44
|
45
|
saveFamily(updateFamily: Family) {
|
|
45
|
46
|
const index = this.families.findIndex((families) => families.id === updateFamily.id);
|
|
46
|
47
|
if (index === -1) {
|
|
47
|
|
- this.families.push(updateFamily);
|
|
48
|
|
- return;
|
|
|
48
|
+ this.families.push(updateFamily);
|
|
|
49
|
+ return;
|
|
49
|
50
|
}
|
|
50
|
51
|
this.families[index] = updateFamily;
|
|
51
|
52
|
}
|
|
52
|
|
- // updateFamily(family: Family);
|
|
53
|
|
- // deleteFamily(id: string);
|
|
|
53
|
+ //家族の情報を削除
|
|
|
54
|
+ deleteFamily(id: string | undefined) {
|
|
|
55
|
+ const index = this.families.findIndex((family) => family.id === id);
|
|
|
56
|
+ if (index === -1) {
|
|
|
57
|
+ return;
|
|
|
58
|
+ }
|
|
|
59
|
+ this.families.splice(index, 1);
|
|
|
60
|
+ }
|
|
54
|
61
|
}
|