Skip to content

Commit

Permalink
Change some function names with getNotes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaHamann committed Apr 7, 2020
1 parent 7ffff63 commit c9ec108
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/app/notes/add-note.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/notes/note-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/notes/note.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Note[]> {
getNotes(filters?: { owner_id?: string}): Observable<Note[]> {
let httpParams: HttpParams = new HttpParams();
if (filters.owner_id) {
httpParams = httpParams.set('owner_id', filters.owner_id);
Expand All @@ -35,4 +35,6 @@ export class NoteService {
console.log(newNote.expiration);
return client;
}


}
2 changes: 1 addition & 1 deletion client/src/app/owners/owner-doorboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);

Expand Down

0 comments on commit c9ec108

Please sign in to comment.