feat: add new pages for authentication (register, forgot password) and course browsing (discovery, course detail)

This commit is contained in:
supalerk-ar66 2026-02-11 15:11:38 +07:00
parent acff387a9b
commit d4f84667dc
4 changed files with 39 additions and 8 deletions

View file

@ -47,6 +47,7 @@ const handleInput = (val: string | number | null) => {
}
const { requestPasswordReset } = useAuth()
const $q = useQuasar()
const sendResetLink = async () => {
if (!validate(forgotForm, forgotRules)) return
@ -60,8 +61,13 @@ const sendResetLink = async () => {
if (result.success) {
forgotStep.value = 'success'
} else {
// Basic alert for now, could be improved with q-notify later
alert(result.error || 'ไม่สามารถส่งลิงก์รีเซ็ตได้ กรุณาลองใหม่')
$q.notify({
type: 'negative',
message: result.error || 'ไม่สามารถส่งลิงก์รีเซ็ตได้ กรุณาลองใหม่',
position: 'top',
timeout: 3000,
actions: [{ icon: 'close', color: 'white' }]
})
}
}
</script>

View file

@ -17,6 +17,7 @@ useHead({
const router = useRouter();
const { register } = useAuth();
const $q = useQuasar();
const { errors, validate, clearFieldError } = useFormValidation();
const isLoading = ref(false);
@ -181,10 +182,21 @@ const handleRegister = async () => {
isLoading.value = false;
if (result.success) {
alert('สมัครสมาชิกสำเร็จ! กรุณาเข้าสู่ระบบ');
$q.notify({
type: 'positive',
message: 'สมัครสมาชิกสำเร็จ! กรุณาเข้าสู่ระบบ',
position: 'top',
timeout: 4000
});
router.push("/auth/login");
} else {
alert(result.error || 'การลงทะเบียนล้มเหลว');
$q.notify({
type: 'negative',
message: result.error || 'การลงทะเบียนล้มเหลว',
position: 'top',
timeout: 3000,
actions: [{ icon: 'close', color: 'white' }]
});
}
};
</script>