feat: Rollback signup on error, cleanup userDto and comment createdBy

This commit is contained in:
2025-08-11 06:55:55 +02:00
parent 851d0fef46
commit b7b6d02cf2
6 changed files with 14 additions and 20 deletions

View File

@@ -3,15 +3,14 @@ import type { CreateCommentDto, CommentDto } from '~/.api-client'
export function useComment(applicationFormId: string) {
const commentStore = useCommentStore()
const { createComment, updateComment } = commentStore
const { userDto } = useAuth()
const { user } = useAuth()
const isEditingComment = ref(false)
const currentEditedComment = ref<CommentDto | null>(null)
const commentTextAreaValue = ref('')
async function submitComment(formElementId: string) {
const newCommentDto: CreateCommentDto = {
message: commentTextAreaValue.value,
createdBy: userDto.value
message: commentTextAreaValue.value
}
try {
await createComment(applicationFormId, formElementId, newCommentDto)
@@ -51,7 +50,7 @@ export function useComment(applicationFormId: string) {
}
function isCommentByUser(comment: CommentDto) {
return comment.createdBy.id === userDto.value.id
return comment.createdBy.id === user.value?.id
}
return {