mirror of
https://github.com/logos-storage/logos-storage-frontend.git
synced 2026-01-11 01:33:07 +00:00
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { create } from "zustand";
|
|
import { persist } from "zustand/middleware";
|
|
import UploadedItemModel from "./data/models/UploadedItemModel";
|
|
|
|
interface NodeInfo {
|
|
baseUrl: string;
|
|
nodeToConnectTo: string | null;
|
|
id: string | null;
|
|
// ip: string | null;
|
|
address: string | null;
|
|
auth: string | null;
|
|
}
|
|
|
|
interface DexyState {
|
|
uploads: UploadedItemModel[];
|
|
setUploads: (uploads: UploadedItemModel[]) => void;
|
|
ftdCid: string;
|
|
setFtdCid: (cid: string) => void;
|
|
nodeInfo: NodeInfo;
|
|
setNodeInfo: (nodeInfo: NodeInfo) => void;
|
|
}
|
|
|
|
export const useDexyStore = create<DexyState>()(
|
|
persist(
|
|
(set, get) => ({
|
|
uploads: [],
|
|
setUploads: (uploads) => set({ uploads }),
|
|
ftdCid: "",
|
|
setFtdCid: (cid) => set({ ftdCid: cid }),
|
|
nodeInfo: {
|
|
baseUrl: "http://localhost:8080",
|
|
nodeToConnectTo: null,
|
|
id: null,
|
|
// ip: null,
|
|
address: null,
|
|
auth: null,
|
|
},
|
|
setNodeInfo: (nodeInfo) => set({ nodeInfo }),
|
|
}),
|
|
{
|
|
name: "dexy-storage",
|
|
}
|
|
)
|
|
);
|