fix: make teamId optional in support form validation (#2417)

The contact form accepts teamId as an optional param based on
where the user clicks "Support" from. Previously, when opened
from a non-team context, the null teamId would be parsed to NaN
and fail validation, causing the form to error out. Now the
validation only runs when a teamId is actually provided.
This commit is contained in:
Lucas Smith
2026-01-27 15:00:53 +11:00
committed by GitHub
parent 17b261df1f
commit 7fc6f5bb6e
@@ -90,10 +90,12 @@ export const profileRouter = router({
const parsedTeamId = teamId ? Number(teamId) : null;
if (Number.isNaN(parsedTeamId)) {
throw new AppError(AppErrorCode.INVALID_BODY, {
message: 'Invalid team ID provided',
});
if (typeof parsedTeamId === 'number') {
if (Number.isNaN(parsedTeamId) || parsedTeamId <= 0) {
throw new AppError(AppErrorCode.INVALID_BODY, {
message: 'Invalid team ID provided',
});
}
}
return await submitSupportTicket({