fix signup code usage

This commit is contained in:
john 2025-05-18 19:11:32 +02:00
parent a3925c3108
commit ca0a6b2950
3 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { User } from '../user/userStore.ts'
import { dispatchMessage } from '../messageBus/messageBus.ts'
import client from '../api/client.ts'
import { ProblemDetails } from '../../types'
export class AuthService {
constructor(private readonly user: User | null) {}
@ -33,7 +34,8 @@ export class AuthService {
})
if (!res.data) {
throw new Error('invalid credentials')
console.error(res.error)
throw new Error((res.error as ProblemDetails)?.detail ?? 'invalid credentials')
}
dispatchMessage('auth:registered', { ...res.data })