fix: registration form — phone mask, required fields, snake_case body

- Address and phone now required (frontend + backend)
- Phone input mask: +7 (XXX) XXX-XX-XX
- Fix Bad Request: register body now sends snake_case keys
  (req() converts camelCase→snake_case, backend schema updated to match)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-30 11:23:24 +03:00
parent 0088457f51
commit 1970afdd13
3 changed files with 62 additions and 24 deletions

View File

@@ -175,13 +175,21 @@ export const api = {
register: (data: {
hotelName: string
address?: string
address: string
contact: string
email: string
phone?: string
phone: string
password: string
}) =>
req<{ ok: boolean; message: string }>('POST', '/api/auth/register', data),
// Snake_case вручную — req() конвертирует camelCase→snake_case автоматически
req<{ ok: boolean; message: string }>('POST', '/api/auth/register', {
hotel_name: data.hotelName,
address: data.address,
contact: data.contact,
email: data.email,
phone: data.phone,
password: data.password,
}),
forgotPassword: (email: string) =>
req<{ ok: boolean }>('POST', '/api/auth/forgot-password', { email }),