Skip to content

Commit

Permalink
fix(org: name required to create organizatio
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindgrutle committed Dec 13, 2023
1 parent 5f21833 commit e428a38
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions next-tavla/app/(admin)/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export function getFormFeedbackForError(e: TError): TFormFeedback {
feedback: 'Denne personen er allerede medlem av organisasjoen.',
variant: 'info',
}
case 'organization/name-missing':
return {
form_type: 'general',
feedback: 'Organisasjonen må ha et navn',
variant: 'warning',
}
}

return {
Expand Down
2 changes: 2 additions & 0 deletions next-tavla/src/Admin/utils/formActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export async function createOrganizationAction(
try {
const name = data.get('name')?.toString() ?? ''

if (!name) return getFormFeedbackForError('organization/name-missing')

const user = await getUserFromSessionCookie()

if (!user) return getFormFeedbackForError('auth/operation-not-allowed')
Expand Down

0 comments on commit e428a38

Please sign in to comment.