Add:api-register
This commit is contained in:
parent
3ab76e7a43
commit
e087ab9b0e
7 changed files with 21 additions and 12 deletions
|
|
@ -51,6 +51,15 @@ const loginRules = {
|
|||
* Validates form and attempts login.
|
||||
* Currently simulates an API call for demonstration.
|
||||
*/
|
||||
/**
|
||||
* Handles input updates, stripping Thai characters and clearing errors.
|
||||
*/
|
||||
const handleInput = (field: keyof typeof loginForm, value: string) => {
|
||||
// Remove Thai characters range \u0E00-\u0E7F
|
||||
loginForm[field] = value.replace(/[\u0E00-\u0E7F]/g, '')
|
||||
clearFieldError(field)
|
||||
}
|
||||
|
||||
const handleLogin = async () => {
|
||||
if (!validate(loginForm, loginRules)) return
|
||||
|
||||
|
|
@ -99,23 +108,23 @@ const handleLogin = async () => {
|
|||
<form @submit.prevent="handleLogin" novalidate>
|
||||
<!-- Email Input -->
|
||||
<FormInput
|
||||
v-model="loginForm.email"
|
||||
:model-value="loginForm.email"
|
||||
label="อีเมล"
|
||||
type="email"
|
||||
placeholder="student@example.com"
|
||||
:error="errors.email"
|
||||
required
|
||||
@update:model-value="clearFieldError('email')"
|
||||
@update:model-value="val => handleInput('email', val)"
|
||||
/>
|
||||
<!-- Password Input -->
|
||||
<FormInput
|
||||
v-model="loginForm.password"
|
||||
:model-value="loginForm.password"
|
||||
label="รหัสผ่าน"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
:error="errors.password"
|
||||
required
|
||||
@update:model-value="clearFieldError('password')"
|
||||
@update:model-value="val => handleInput('password', val)"
|
||||
/>
|
||||
|
||||
<!-- Helpers: Remember Me & Forgot Password -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue