add pin to hover view + add number of pins to dashboard + bug fixes
This commit is contained in:
@@ -107,9 +107,15 @@ export default async function getDashboardData(
|
||||
const links = [...recentlyAddedLinks, ...pinnedLinks].sort(
|
||||
(a, b) => new Date(b.id).getTime() - new Date(a.id).getTime()
|
||||
);
|
||||
|
||||
// Make sure links are unique
|
||||
const uniqueLinks = links.filter(
|
||||
(link, index, self) => index === self.findIndex((t) => t.id === link.id)
|
||||
);
|
||||
|
||||
return {
|
||||
data: {
|
||||
links,
|
||||
links: uniqueLinks,
|
||||
numberOfPinnedLinks,
|
||||
},
|
||||
message: "Dashboard data fetched successfully.",
|
||||
|
||||
@@ -124,7 +124,7 @@ export default async function updateLinkById(
|
||||
})),
|
||||
},
|
||||
pinnedBy:
|
||||
data?.pinnedBy && data.pinnedBy[0]
|
||||
data?.pinnedBy && data.pinnedBy[0].id === userId
|
||||
? { connect: { id: userId } }
|
||||
: { disconnect: { id: userId } },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user