Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

599 B
Raw Blame
import { create } from "zustand";
import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types/global";
import { User } from "@linkwarden/prisma/client";

type Tmp = {
  link: LinkIncludingShortenedCollectionAndTags | null;
  user: Pick<User, "id"> | null;
};

type TmpStore = {
  tmp: Tmp;
  updateTmp: (newData: Partial<Tmp>) => void;
};

const useTmpStore = create<TmpStore>((set, get) => ({
  tmp: {
    link: null,
    user: null,
  },
  updateTmp: async (patch) => {
    const merged = { ...get().tmp, ...patch };
    set({ tmp: merged });
  },
}));

export default useTmpStore;