fix signup code usage
This commit is contained in:
parent
a3925c3108
commit
ca0a6b2950
3 changed files with 21 additions and 2 deletions
|
@ -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 })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue