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

@@ -27,7 +27,7 @@ definePageMeta({ layout: 'auth' })
useSeoMeta({ title: 'Sign up' })
const toast = useToast()
const { signUp } = useAuth()
const { signUp, deleteUser } = useAuth()
const { createUser } = useUser()
const fields = [
@@ -116,8 +116,9 @@ function onSubmit(payload: FormSubmitEvent<Schema>) {
await navigateTo('/')
},
onError: (ctx) => {
onError: async (ctx) => {
console.log(ctx.error.message)
await deleteUser({ callbackURL: '/signup' })
useToast().add({
title: 'Fehler bei der Registrierung',
description: ctx.error.message,