Added allLinksOfCollection to linksStore

Removed duplicated tags
Fixed overflow for line
added disclosure for tags in public collection
This commit is contained in:
Oliver Schwamb
2024-07-09 13:50:08 +02:00
parent e045c18b7d
commit e8d0cce58a
3 changed files with 87 additions and 36 deletions
+4
View File
@@ -11,11 +11,13 @@ type ResponseObject = {
type LinkStore = {
links: LinkIncludingShortenedCollectionAndTags[];
selectedLinks: LinkIncludingShortenedCollectionAndTags[];
allLinksOfCollection: LinkIncludingShortenedCollectionAndTags[];
setLinks: (
data: LinkIncludingShortenedCollectionAndTags[],
isInitialCall: boolean
) => void;
setSelectedLinks: (links: LinkIncludingShortenedCollectionAndTags[]) => void;
setAllLinksOfCollection: (links: LinkIncludingShortenedCollectionAndTags[]) => void;
addLink: (
body: LinkIncludingShortenedCollectionAndTags
) => Promise<ResponseObject>;
@@ -39,6 +41,7 @@ type LinkStore = {
const useLinkStore = create<LinkStore>()((set) => ({
links: [],
selectedLinks: [],
allLinksOfCollection: [],
setLinks: async (data, isInitialCall) => {
isInitialCall &&
set(() => ({
@@ -58,6 +61,7 @@ const useLinkStore = create<LinkStore>()((set) => ({
}));
},
setSelectedLinks: (links) => set({ selectedLinks: links }),
setAllLinksOfCollection: (links) => set({allLinksOfCollection: links}),
addLink: async (body) => {
const response = await fetch("/api/v1/links", {
body: JSON.stringify(body),