vikunja/frontend/src/helpers
Copilot c6f0d8babe
feat: surface API validation errors to registration form fields (#1902)
This PR surfaces API validation errors from the registration endpoint
directly onto the corresponding form fields, instead of only showing a
generic "invalid data" message. A new `parseValidationErrors` helper
extracts field names and messages from the API's `invalid_fields` array
(e.g. `["email: email is not a valid email address"]`) and maps them to
the appropriate form fields. The Register component integrates this
parser into its error handling, prioritizing client-side validation but
falling back to server-side field errors when present. Errors are
cleared as the user types.

A follow-up commit addressed PR review feedback: the `ValidationError`
interface is now exported from the parser module and reused in
`Register.vue` (eliminating a duplicate `ApiValidationError` interface),
the type guard was tightened to check specifically for `invalid_fields`
rather than broadly matching any object with a `message` property, the
fallback error message always uses the localized translation key instead
of potentially surfacing raw backend messages, and the
`serverValidationErrors` ref uses `Partial<Record>` to accurately
reflect that keys are optional.

🐰 A parser hops through error fields,
Catching field names as each one yields,
Client and server now both agree,
Validation flows harmoniously free!
Whitespace trimmed, no colon? It hops along,
Register form now validated strong! 

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kolaente <k@knt.li>
2026-03-03 14:27:24 +01:00
..
color feat(gantt): rebuild the gantt chart (#1001) 2025-08-12 16:33:50 +02:00
time fix: iterate past rejected middle matches in matchDateAtBoundary() 2026-02-06 10:57:50 +01:00
attachments.ts fix: format attachment upload error messages as readable strings 2026-02-08 15:48:04 +01:00
auth.ts feat: add frontend session management with refresh tokens 2026-02-25 10:30:25 +01:00
calculateItemPosition.ts fix(positions): detect and repair duplicate task positions automatically (#1998) 2025-12-20 19:38:28 +01:00
calculateTaskPosition.test.ts fix(positions): detect and repair duplicate task positions automatically (#1998) 2025-12-20 19:38:28 +01:00
case.ts feat: switch to change-case lib 2024-06-18 06:30:39 +00:00
checkAndSetApiUrl.ts feat(dev): use proxy server in dev mode (#3069) 2025-03-09 13:40:57 +00:00
checklistFromText.test.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
checklistFromText.ts feat: consistent sorting 2025-06-02 22:27:03 +02:00
closeWhenClickedOutside.ts fix: prevent emoji picker from closing when clicking search input (#1959) 2025-12-09 12:59:01 +01:00
createAsyncComponent.ts chore: fix indentation 2025-06-19 10:53:35 +02:00
downloadBlob.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
editorContentEmpty.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
editorDraftStorage.ts feat(editor): automatically save draft comments locally (#1868) 2025-11-24 22:23:58 +00:00
fetcher.ts feat: add frontend session management with refresh tokens 2026-02-25 10:30:25 +01:00
filters.test.ts fix: prevent cursor reset when typing in filter input (#2287) 2026-02-24 11:50:45 +00:00
filters.ts fix(filter): correct filter autocomplete for project names with spaces (#2012) 2026-01-10 22:18:34 +01:00
ganttRelationArrows.spec.ts feat(gantt): integrate task tree into Gantt rendering with collapse 2026-03-03 13:11:43 +01:00
ganttRelationArrows.ts fix(gantt): spread overlapping relation arrows at shared endpoints 2026-03-03 13:11:43 +01:00
ganttTaskTree.spec.ts feat(gantt): integrate task tree into Gantt rendering with collapse 2026-03-03 13:11:43 +01:00
ganttTaskTree.ts fix(gantt): only set hasDerivedDates when children have actual dates 2026-03-03 13:11:43 +01:00
getBlobFromBlurHash.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
getFullBaseUrl.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
getHumanSize.ts chore: fix indentation 2025-06-19 10:53:35 +02:00
getInheritedBackgroundColor.ts chore: fix indentation 2025-06-19 10:53:35 +02:00
getProjectTitle.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
hourToDaytime.test.ts chore: add missing eof newlines (#969) 2025-06-17 09:11:32 +00:00
hourToDaytime.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
inputPrompt.ts refactor(shortcuts): replace eventToHotkeyString with eventToShortcutString 2026-03-03 14:00:25 +01:00
isAppleDevice.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
isEmail.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
isValidHttpUrl.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
parseDateOrNull.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
parseScopesFromQuery.test.ts feat(api-tokens): support title and scopes query parameters (#2143) 2026-01-24 18:08:23 +00:00
parseScopesFromQuery.ts feat(api-tokens): support title and scopes query parameters (#2143) 2026-01-24 18:08:23 +00:00
parseSubtasksViaIndention.test.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
parseSubtasksViaIndention.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
parseValidationErrors.test.ts feat: surface API validation errors to registration form fields (#1902) 2026-03-03 14:27:24 +01:00
parseValidationErrors.ts feat: surface API validation errors to registration form fields (#1902) 2026-03-03 14:27:24 +01:00
playPop.ts feat: simplify playPopSound setting check 2024-07-05 14:24:53 +02:00
projectView.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
randomId.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
redirectToProvider.ts feat: assign users to teams via OIDC claims (#1393) 2024-03-02 08:47:10 +00:00
replaceAll.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
saveCollapsedBucketState.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
saveLastVisited.ts chore: move frontend files 2024-02-07 14:56:56 +01:00
scrollIntoView.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
setTitle.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
shortcut.test.ts fix(shortcuts): track active sequences explicitly to prevent misfires 2026-03-03 14:00:25 +01:00
shortcut.ts fix(shortcuts): track active sequences explicitly to prevent misfires 2026-03-03 14:00:25 +01:00
useFlatpickrLanguage.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
utils.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00
validatePasswort.ts fix: add newline at end of line (#827) 2025-05-24 13:57:47 +02:00