feat(frontend): Refactor organization, fixed several organization bugs

This commit is contained in:
2025-08-17 09:28:26 +02:00
parent b7b6d02cf2
commit 6090d543c1
14 changed files with 279 additions and 221 deletions

View File

@@ -1,12 +1,13 @@
import type { CreateCommentDto, CommentDto } from '~/.api-client'
export function useComment(applicationFormId: string) {
export function useCommentTextarea(applicationFormId: string) {
const commentStore = useCommentStore()
const { createComment, updateComment } = commentStore
const { user } = useAuth()
const isEditingComment = ref(false)
const currentEditedComment = ref<CommentDto | null>(null)
const commentTextAreaValue = ref('')
const toast = useToast()
async function submitComment(formElementId: string) {
const newCommentDto: CreateCommentDto = {
@@ -15,9 +16,9 @@ export function useComment(applicationFormId: string) {
try {
await createComment(applicationFormId, formElementId, newCommentDto)
commentTextAreaValue.value = ''
useToast().add({ title: 'Comment created successfully', color: 'success' })
toast.add({ title: 'Comment created successfully', color: 'success' })
} catch (e) {
useToast().add({ title: 'Error creating comment', color: 'error' })
toast.add({ title: 'Error creating comment', color: 'error' })
console.error('Error creating comment:', e)
}
}
@@ -30,9 +31,9 @@ export function useComment(applicationFormId: string) {
commentTextAreaValue.value = ''
currentEditedComment.value = null
isEditingComment.value = false
useToast().add({ title: 'Comment updated successfully', color: 'success' })
toast.add({ title: 'Comment updated successfully', color: 'success' })
} catch (e) {
useToast().add({ title: 'Error updating comment', color: 'error' })
toast.add({ title: 'Error updating comment', color: 'error' })
console.error('Error updating comment:', e)
}
}