global.ts 490 B

123456789101112131415161718192021222324252627
  1. import { createPersistStore } from "../utils/store";
  2. const state = {
  3. selectedAppId: "",
  4. currentSession: {
  5. appId: '',
  6. dialogName: '',
  7. id: '',
  8. messages: [],
  9. },
  10. };
  11. export const useGlobalStore = createPersistStore(
  12. { ...state },
  13. (set, get) => ({
  14. setSelectedAppId(appId: string) {
  15. set({ selectedAppId: appId });
  16. },
  17. setCurrentSession(session: any) {
  18. set({ currentSession: session });
  19. },
  20. }),
  21. {
  22. name: "Global",
  23. version: 1,
  24. },
  25. );