feat(frontend): Refactor organization, fixed several organization bugs
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user