diff options
| author | 2026-03-02 10:26:21 +0800 | |
|---|---|---|
| committer | 2026-03-02 10:26:21 +0800 | |
| commit | 9e40b5b7bea60e6802a4b448ef315b14fba4de7f (patch) | |
| tree | da58ce5de37c3c47cbc82fea5ed343b163852f46 /packages/ui/src/models | |
| parent | 47aeabf5d44d7483101d30d289cb4c56761e3faa (diff) | |
| download | DropOut-9e40b5b7bea60e6802a4b448ef315b14fba4de7f.tar.gz DropOut-9e40b5b7bea60e6802a4b448ef315b14fba4de7f.zip | |
feat(ui): java config
Diffstat (limited to 'packages/ui/src/models')
| -rw-r--r-- | packages/ui/src/models/java.ts | 25 |
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 }); + }, +})); |