From c9ec1083a8b66233dafc4c757b5a45949d484021 Mon Sep 17 00:00:00 2001 From: JoshuaHamann Date: Mon, 6 Apr 2020 19:46:59 -0500 Subject: [PATCH] Change some function names with getNotes #17 --- client/src/app/notes/add-note.component.ts | 2 +- client/src/app/notes/note-card.component.ts | 4 ++++ client/src/app/notes/note.service.ts | 4 +++- client/src/app/owners/owner-doorboard.component.ts | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/app/notes/add-note.component.ts b/client/src/app/notes/add-note.component.ts index 7b8ce07..2f42b7a 100644 --- a/client/src/app/notes/add-note.component.ts +++ b/client/src/app/notes/add-note.component.ts @@ -69,7 +69,7 @@ export class AddNoteComponent implements OnInit { expiration: newDate.toISOString() }; - this.noteService.addNote(this.id, newNote).subscribe((newID) => { + this.noteService.addNote(this.id, newNote).subscribe(newID => { this.snackBar.open('Posted', null, { duration: 2000, }); diff --git a/client/src/app/notes/note-card.component.ts b/client/src/app/notes/note-card.component.ts index 7bffea5..469df3d 100644 --- a/client/src/app/notes/note-card.component.ts +++ b/client/src/app/notes/note-card.component.ts @@ -9,8 +9,12 @@ import { ActivatedRoute } from '@angular/router'; templateUrl: './note-card.component.html', styleUrls: ['./note-card.component.scss'] }) + + export class NoteCardComponent implements OnInit, OnDestroy { // This would be in the doorboard component notes: Note[]; + getNotesSub: Subscription; + public serverFilteredNotes: Note[]; id: string; @Input() note: Note; @Input() simple ? = false; diff --git a/client/src/app/notes/note.service.ts b/client/src/app/notes/note.service.ts index 7ca0f29..41d1ed2 100644 --- a/client/src/app/notes/note.service.ts +++ b/client/src/app/notes/note.service.ts @@ -17,7 +17,7 @@ export class NoteService { // maybe this needs to be formatted like getNotes where we return with params:httpParams? // currently this doesn't filter anything. It just displays all the notes. - getOwnerNotes(filters?: { owner_id?: string}): Observable { + getNotes(filters?: { owner_id?: string}): Observable { let httpParams: HttpParams = new HttpParams(); if (filters.owner_id) { httpParams = httpParams.set('owner_id', filters.owner_id); @@ -35,4 +35,6 @@ export class NoteService { console.log(newNote.expiration); return client; } + + } diff --git a/client/src/app/owners/owner-doorboard.component.ts b/client/src/app/owners/owner-doorboard.component.ts index 7938715..6a7eba5 100644 --- a/client/src/app/owners/owner-doorboard.component.ts +++ b/client/src/app/owners/owner-doorboard.component.ts @@ -29,7 +29,7 @@ export class OwnerDoorBoardComponent implements OnInit, OnDestroy { this.route.paramMap.subscribe((pmap) => { this.id = pmap.get('id'); this.getOwnerSub = this.ownerService.getOwnerById(this.id).subscribe(owner => this.owner = owner); - this.getNotesSub = this.noteService.getOwnerNotes({ owner_id: this.id }).subscribe(notes => + this.getNotesSub = this.noteService.getNotes({ owner_id: this.id }).subscribe(notes => this.notes = notes.reverse() );