Skip to content

Commit

Permalink
[#48] fix: bmarks tab buttons no update correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Feb 4, 2022
1 parent e9e65b6 commit f5565d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/src/models/Lecture.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export default class Lecture {
this.isBookmarked = isIn(raw, bookmarks, 'id');
this.isSpike = isIn(raw, spikes, 'id');
this.isAdded = false;
this.count = raw.count;
this.count = {
...raw.count,
bookmark: bookmarks.find(({ id }) => id === this.id)?.count?.bookmark || 0,
spike: spikes.find(({ id }) => id === this.id)?.count?.spike || 0,
};
console.log(this);
}

static getSearchResults = async (search, page) =>
Expand All @@ -39,7 +44,7 @@ export default class Lecture {

export class BookmarkedLecture extends Lecture {
constructor(raw, spikes) {
return super({ ...raw, isBookmarked: true }, [], spikes);
return super({ ...raw, isBookmarked: true }, [raw], spikes);
}
}

Expand Down

0 comments on commit f5565d0

Please sign in to comment.