|
|
@@ -6,7 +6,8 @@ import _ from 'lodash';
|
|
|
export class ImpressionsStore {
|
|
|
constructor() {}
|
|
|
|
|
|
- addDashboardImpression(slug) {
|
|
|
+ addDashboardImpression(impression) {
|
|
|
+ console.log(impression);
|
|
|
var impressions = [];
|
|
|
if (store.exists("dashboard_impressions")) {
|
|
|
impressions = JSON.parse(store.get("dashboard_impressions"));
|
|
|
@@ -15,12 +16,14 @@ export class ImpressionsStore {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var exists = impressions.indexOf(slug);
|
|
|
- if (exists >= 0) {
|
|
|
- impressions.splice(exists, 1);
|
|
|
- }
|
|
|
+ impressions = impressions.filter((imp) => {
|
|
|
+ return impression.meta.slug !== imp.slug;
|
|
|
+ });
|
|
|
|
|
|
- impressions.unshift(slug);
|
|
|
+ impressions.unshift({
|
|
|
+ title: impression.dashboard.title,
|
|
|
+ slug: impression.meta.slug
|
|
|
+ });
|
|
|
|
|
|
if (impressions.length > 20) {
|
|
|
impressions.shift();
|