feat: Introduce useCourse and useAuth composables, and add new pages for user registration and dynamic course details.

This commit is contained in:
supalerk-ar66 2026-01-22 11:04:57 +07:00
parent ffd2d55e33
commit 7b22699b13
4 changed files with 7 additions and 46 deletions

View file

@ -20,7 +20,7 @@ const { errors, validate, clearFieldError } = useFormValidation();
const isLoading = ref(false);
// Reactive form state
const registerForm = reactive({
prefix: "นาย",
username: "",
@ -32,7 +32,7 @@ const registerForm = reactive({
confirmPassword: "",
});
// Validation rules
const registerRules = {
username: {
rules: {
@ -197,11 +197,7 @@ const handleRegister = async () => {
</p>
</div>
<!-- Tabs Removed -->
<!-- REGISTER FORM -->
<form @submit.prevent="handleRegister">
<!-- Username -->
<FormInput
:model-value="registerForm.username"
label="ชื่อผู้ใช้"
@ -211,7 +207,6 @@ const handleRegister = async () => {
class="dark-form-input"
@update:model-value="onUsernameInput"
/>
<!-- Email -->
<FormInput
:model-value="registerForm.email"
label="อีเมล"
@ -223,7 +218,6 @@ const handleRegister = async () => {
@update:model-value="onEmailInput"
/>
<!-- Password Fields -->
<FormInput
:model-value="registerForm.password"
label="รหัสผ่าน"
@ -246,7 +240,6 @@ const handleRegister = async () => {
@update:model-value="clearFieldError('confirmPassword')"
/>
<!-- Name Fields (Split Row) -->
<div class="grid-12" style="gap: 16px; margin-bottom: 0">
<div class="col-span-4">
<label class="input-label text-gray-300">คำนำหน</label>
@ -294,7 +287,6 @@ const handleRegister = async () => {
@update:model-value="onPhoneInput"
/>
<!-- Submit Button -->
<button
type="submit"
class="btn btn-primary w-full mb-4 mt-2"
@ -305,7 +297,6 @@ const handleRegister = async () => {
<span v-else>สร้างบัญชี</span>
</button>
<!-- Toggle to Login -->
<div class="text-center mt-6 text-sm">
<span class="text-muted">ญชอยแล? </span>
<NuxtLink to="/auth/login" class="font-bold text-primary hover:underline">เขาสระบบ</NuxtLink>