Refactor authentication routes to use '/auth' prefix in API calls
All checks were successful
Chore App Build and Push Docker Images / build-and-push (push) Successful in 38s
All checks were successful
Chore App Build and Push Docker Images / build-and-push (push) Successful in 38s
This commit is contained in:
@@ -161,7 +161,9 @@ onMounted(async () => {
|
||||
// Validate token with backend
|
||||
if (token.value) {
|
||||
try {
|
||||
const res = await fetch(`/api/validate-reset-token?token=${encodeURIComponent(token.value)}`)
|
||||
const res = await fetch(
|
||||
`/api/auth/validate-reset-token?token=${encodeURIComponent(token.value)}`,
|
||||
)
|
||||
tokenChecked.value = true
|
||||
if (res.ok) {
|
||||
tokenValid.value = true
|
||||
@@ -169,16 +171,22 @@ onMounted(async () => {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
errorMsg.value = data.error || 'This password reset link is invalid or has expired.'
|
||||
tokenValid.value = false
|
||||
// Redirect to AuthLanding
|
||||
router.push({ name: 'AuthLanding' }).catch(() => (window.location.href = '/auth'))
|
||||
}
|
||||
} catch {
|
||||
errorMsg.value = 'Network error. Please try again.'
|
||||
tokenValid.value = false
|
||||
tokenChecked.value = true
|
||||
// Redirect to AuthLanding
|
||||
router.push({ name: 'AuthLanding' }).catch(() => (window.location.href = '/auth'))
|
||||
}
|
||||
} else {
|
||||
errorMsg.value = 'No reset token provided.'
|
||||
tokenValid.value = false
|
||||
tokenChecked.value = true
|
||||
// Redirect to AuthLanding
|
||||
router.push({ name: 'AuthLanding' }).catch(() => (window.location.href = '/auth'))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -190,7 +198,7 @@ async function submitForm() {
|
||||
if (!formValid.value) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fetch('/api/reset-password', {
|
||||
const res = await fetch('/api/auth/reset-password', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user