aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/ui/src/models/java.ts
diff options
context:
space:
mode:
authorNtskwK <natsukawa247@outlook.com>2026-03-17 17:40:05 +0800
committerNtskwK <natsukawa247@outlook.com>2026-03-17 17:40:05 +0800
commit1812ca8974aee347b61bd415c1e2b63a205137dd (patch)
tree9691205659cd39d8641bc5c1db0d801a7d3fbf2f /packages/ui/src/models/java.ts
parente51e6ef36721b8e3915cd3053b6218e2d5c88cb2 (diff)
parente356ab996ad3ef4ad5fb9c90d4a4b4e61ff3342d (diff)
downloadDropOut-1812ca8974aee347b61bd415c1e2b63a205137dd.tar.gz
DropOut-1812ca8974aee347b61bd415c1e2b63a205137dd.zip
Merge branch 'main' of https://github.com/HydroRoll-Team/DropOut
Diffstat (limited to 'packages/ui/src/models/java.ts')
-rw-r--r--packages/ui/src/models/java.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/ui/src/models/java.ts b/packages/ui/src/models/java.ts
new file mode 100644
index 0000000..3e5d2d0
--- /dev/null
+++ b/packages/ui/src/models/java.ts
@@ -0,0 +1,25 @@
+import { create } from "zustand/react";
+import { detectJava, refreshJavaCatalog } from "@/client";
+import type { JavaCatalog, JavaInstallation } from "@/types";
+
+export interface JavaState {
+ catalog: JavaCatalog | null;
+ installations: JavaInstallation[] | null;
+
+ refresh: () => Promise<void>;
+ refreshInstallations: () => Promise<void>;
+}
+
+export const useJavaStore = create<JavaState>((set) => ({
+ catalog: null,
+ installations: null,
+
+ refresh: async () => {
+ const catalog = await refreshJavaCatalog();
+ set({ catalog });
+ },
+ refreshInstallations: async () => {
+ const installations = await detectJava();
+ set({ installations });
+ },
+}));