-
+
diff --git a/src/store/store.js b/src/store/store.js
index 6ce79f7..948ee74 100644
--- a/src/store/store.js
+++ b/src/store/store.js
@@ -9,6 +9,9 @@ const useStore = create((set) => ({
showStartScreen: true,
saveOnServer: false,
intermediateData: null,
+ project: localStorage.getItem("project"),
+ projectID: localStorage.getItem("projectID"),
+ setProjectID: (projectID) => set(() => ({ projectID: projectID })),
setUuid: (uuid) => set(() => ({ uuid: uuid })),
setIsShosen: (isShosen) => set(() => ({ isShosen: isShosen })),
setName: (name) => set(() => ({ name: name })),
@@ -22,6 +25,9 @@ const useStore = create((set) => ({
set((state) => ({ saveOnServer: !state.saveOnServer })),
}));
+export const useProjectID = () => useStore((state) => state.projectID);
+export const useSetProjectID = () => useStore((state) => state.setProjectID);
+
export const useIsShosen = () => useStore((state) => state.isShosen);
export const useSetIsShosen = () => useStore((state) => state.setIsShosen);
diff --git a/src/ui/Select.tsx b/src/ui/Select.tsx
index 523dd5d..07b83c2 100644
--- a/src/ui/Select.tsx
+++ b/src/ui/Select.tsx
@@ -4,16 +4,19 @@ import SearchIcon from "@/IconsComponents/SearchIcon";
import CloseIcon from "@/IconsComponents/CloseIcon";
import useSWR from "swr";
import { fetcher } from "@/lib/fetcher";
+import { useSetProjectID } from "../store/store";
export default function Select({ url, setProjectName, projectName }) {
const [open, setOpen] = useState(false);
const [project, setProject] = useState(() => localStorage.getItem("project"));
- const [projectID, setProjectID] = useState(() =>
- localStorage.getItem("projectID")
- );
+ // const [projectID, setProjectID] = useState(() =>
+ // localStorage.getItem("projectID")
+ // );
const [filtered, setFiltered] = useState([]);
const [search, setSearch] = useState("");
+ const setProjectID = useSetProjectID();
+
const { data, isLoading } = useSWR(url, fetcher, {
revalidateIfStale: false,
revalidateOnFocus: false,
@@ -33,6 +36,7 @@ export default function Select({ url, setProjectName, projectName }) {
const resetProject = () => {
setProjectName("");
+ setProjectID("");
localStorage.setItem("project", "");
localStorage.setItem("projectID", "");
localStorage.clear();