mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(ocm-cli): workspace repo sync and manager token targeting (#233)
This commit is contained in:
1 parent
e12f319592
commit
a86e4b1238
69 files changed
+4858
-161
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
export interface SendError {
|
||||
sessionID: string
|
||||
title: string
|
||||
message: string
|
||||
detail?: string
|
||||
}
|
||||
|
||||
interface SendErrorStore {
|
||||
errors: Record<string, SendError>
|
||||
setError: (err: SendError) => void
|
||||
clearError: (sessionID: string) => void
|
||||
getError: (sessionID: string) => SendError | null
|
||||
}
|
||||
|
||||
export const useSendErrorStore = create<SendErrorStore>((set, get) => ({
|
||||
errors: {},
|
||||
setError: (err: SendError) => {
|
||||
set((state) => ({
|
||||
errors: { ...state.errors, [err.sessionID]: err },
|
||||
}))
|
||||
},
|
||||
clearError: (sessionID: string) => {
|
||||
set((state) => {
|
||||
const newErrors = { ...state.errors }
|
||||
delete newErrors[sessionID]
|
||||
return { errors: newErrors }
|
||||
})
|
||||
},
|
||||
getError: (sessionID: string) => {
|
||||
return get().errors[sessionID] || null
|
||||
},
|
||||
}))
|
||||
Reference in new issue
Block a user