feat: make spatial entry optional and authoritative
This commit is contained in:
@@ -217,6 +217,25 @@ export function useProjectWorkspace() {
|
||||
}
|
||||
}
|
||||
|
||||
const activateMunicipality = async (niscode: string): Promise<AreaRead | null> => {
|
||||
if (!selectedProjectId) {
|
||||
setErrorMessage('Kies eerst een werkruimte')
|
||||
return null
|
||||
}
|
||||
setLoadingAreas(true)
|
||||
setErrorMessage(null)
|
||||
try {
|
||||
const area = await areasApi.activateMunicipality(selectedProjectId, niscode)
|
||||
await loadProjectData(selectedProjectId)
|
||||
return area
|
||||
} catch (error) {
|
||||
setErrorMessage(error instanceof Error ? error.message : 'De gemeente kon niet als werkgebied worden geladen')
|
||||
return null
|
||||
} finally {
|
||||
setLoadingAreas(false)
|
||||
}
|
||||
}
|
||||
|
||||
const archiveProject = async (projectId: string) => {
|
||||
setArchivingProjectId(projectId)
|
||||
setErrorMessage(null)
|
||||
@@ -257,6 +276,7 @@ export function useProjectWorkspace() {
|
||||
loadProjectData,
|
||||
createProject,
|
||||
createArea,
|
||||
activateMunicipality,
|
||||
archiveProject,
|
||||
resetProjectData,
|
||||
setSelectedProjectId,
|
||||
|
||||
Reference in New Issue
Block a user