diff options
| author | 2026-03-30 17:28:40 +0800 | |
|---|---|---|
| committer | 2026-03-30 17:28:40 +0800 | |
| commit | 0c689afe68792fafca67746b9ece2a06760c6069 (patch) | |
| tree | 8d0feac4fec8c8ac06994f28949915d348eb3cc9 /packages/ui/src/models/instance.ts | |
| parent | 382dfc68f1ecb09f277f82b0b2e0b466e1c79d06 (diff) | |
| parent | c4dc0676d794bca2613be282867d369328ebf073 (diff) | |
| download | DropOut-0c689afe68792fafca67746b9ece2a06760c6069.tar.gz DropOut-0c689afe68792fafca67746b9ece2a06760c6069.zip | |
Merge branch 'main' of https://github.com/HydroRoll-Team/DropOut into chore/docs
Diffstat (limited to 'packages/ui/src/models/instance.ts')
| -rw-r--r-- | packages/ui/src/models/instance.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/packages/ui/src/models/instance.ts b/packages/ui/src/models/instance.ts index 2f338b5..8c108c1 100644 --- a/packages/ui/src/models/instance.ts +++ b/packages/ui/src/models/instance.ts @@ -20,7 +20,7 @@ interface InstanceState { activeInstance: Instance | null; refresh: () => Promise<void>; - create: (name: string) => Promise<Instance | null>; + create: (name: string) => Promise<Instance>; delete: (id: string) => Promise<void>; update: (instance: Instance) => Promise<void>; setActiveInstance: (instance: Instance) => Promise<void>; @@ -64,17 +64,11 @@ export const useInstanceStore = create<InstanceState>((set, get) => ({ create: async (name) => { const { refresh } = get(); - try { - const instance = await createInstance(name); - await setActiveInstanceCommand(instance.id); - await refresh(); - toast.success(`Instance "${name}" created successfully`); - return instance; - } catch (e) { - console.error("Failed to create instance:", e); - toast.error(String(e)); - return null; - } + const instance = await createInstance(name); + await setActiveInstanceCommand(instance.id); + await refresh(); + toast.success(`Instance "${name}" created successfully`); + return instance; }, delete: async (id) => { |