This commit is contained in:
Isaac Wise
2024-02-10 18:34:25 -06:00
parent 58e2fb22c9
commit 059fcecc5f
20 changed files with 360 additions and 269 deletions
+8 -4
View File
@@ -23,7 +23,13 @@ type LinkStore = {
updateLink: (
link: LinkIncludingShortenedCollectionAndTags
) => Promise<ResponseObject>;
updateLinks: (links: LinkIncludingShortenedCollectionAndTags[], newData: Pick<LinkIncludingShortenedCollectionAndTags, "tags" | "collectionId">) => Promise<ResponseObject>;
updateLinks: (
links: LinkIncludingShortenedCollectionAndTags[],
newData: Pick<
LinkIncludingShortenedCollectionAndTags,
"tags" | "collectionId"
>
) => Promise<ResponseObject>;
removeLink: (linkId: number) => Promise<ResponseObject>;
deleteLinksById: (linkIds: number[]) => Promise<ResponseObject>;
resetLinks: () => void;
@@ -142,9 +148,7 @@ const useLinkStore = create<LinkStore>()((set) => ({
if (response.ok) {
set((state) => ({
links: state.links.map((e) =>
links.some((link) => link.id === e.id)
? { ...e, ...newData }
: e
links.some((link) => link.id === e.id) ? { ...e, ...newData } : e
),
}));
useTagStore.getState().setTags();