Phase 3 implementation. Coordinate system implemented. Initial text box tool implemented.
This commit is contained in:
parent
c159ad4f37
commit
4cb038ec78
34 changed files with 6676 additions and 130 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { create } from 'zustand'
|
||||
import { libraryApi } from './api'
|
||||
import type { DocumentMeta } from './types'
|
||||
import type { DocumentMeta, DocumentUpdateRequest } from './types'
|
||||
|
||||
interface LibraryState {
|
||||
documents: DocumentMeta[]
|
||||
|
|
@ -25,6 +25,7 @@ interface LibraryState {
|
|||
bulkRestore: () => Promise<void>
|
||||
emptyTrash: () => Promise<void>
|
||||
setSearchQuery: (query: string) => void
|
||||
updateDocument: (id: string, data: DocumentUpdateRequest) => Promise<void>
|
||||
}
|
||||
|
||||
export const useLibrary = create<LibraryState>((set, get) => ({
|
||||
|
|
@ -176,5 +177,19 @@ export const useLibrary = create<LibraryState>((set, get) => ({
|
|||
set({ error: err.error?.message || err.message, isLoading: false })
|
||||
throw err
|
||||
}
|
||||
},
|
||||
|
||||
updateDocument: async (id: string, data: DocumentUpdateRequest) => {
|
||||
set({ isLoading: true, error: null })
|
||||
try {
|
||||
const updatedDoc = await libraryApi.updateDocument(id, data)
|
||||
set((state) => ({
|
||||
documents: state.documents.map(d => d.id === id ? updatedDoc : d),
|
||||
isLoading: false
|
||||
}))
|
||||
} catch (err: any) {
|
||||
set({ error: err.error?.message || err.message, isLoading: false })
|
||||
throw err
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue