school-dashboard-exercise/src/zustand/ObjectToEditState.ts
2024-06-27 10:54:19 +03:00

48 lines
1.6 KiB
TypeScript

import { create } from "zustand";
interface ModelState {
object_to_edit: any;
set_object_to_edit: (data: any) => void;
old_object_to_edit: any;
set_old_object_to_edit: (data: any) => void;
object_ids: any;
set_object_ids: (data: any) => void;
param_to_send: any;
set_param_to_send: (data: any) => void;
Tags_search: any;
set_Tags_search: (data: any) => void;
Tags_query: any;
set_Tags_query: (data: any) => void;
currentTag: any;
set_currentTag: (data: any) => void;
current_parent_index: any;
set_current_parent_index: (data: any) => void;
isBseQuestion: boolean;
set_isBseQuestion: (data: any) => void;
Success: boolean;
set_Success: (data: any) => void;
}
export const useObjectToEdit = create<ModelState>((set) => ({
object_to_edit: null,
set_object_to_edit: (data) => set(() => ({ object_to_edit: data })),
old_object_to_edit: null,
set_old_object_to_edit: (data) => set(() => ({ old_object_to_edit: data })),
object_ids: [],
set_object_ids: (data) => set(() => ({ object_ids: data })),
param_to_send: {},
set_param_to_send: (data) => set(() => ({ param_to_send: data })),
Tags_search: null,
set_Tags_search: (data) => set(() => ({ Tags_search: data })),
Tags_query: null,
set_Tags_query: (data) => set(() => ({ Tags_query: data })),
currentTag: null,
set_currentTag: (data) => set(() => ({ currentTag: data })),
current_parent_index: null,
set_current_parent_index: (data) => set(() => ({ current_parent_index: data })),
isBseQuestion: false,
set_isBseQuestion: (data) => set(() => ({ isBseQuestion: data })),
Success: false,
set_Success: (data) => set(() => ({ Success: data })),
}));