File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
(org)/onboarding/organization-setup
api/settings/onboarding/org-setup Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ export default function OrganizationSetupPage() {
5151 router . push ( "/onboarding/custom-domain" ) ;
5252 router . refresh ( ) ;
5353 } ) ;
54- } catch {
54+ } catch ( error ) {
55+ console . error ( error ) ;
5556 toast . error ( "An error occurred, please try again" ) ;
5657 } finally {
5758 setIsLoading ( false ) ;
Original file line number Diff line number Diff line change @@ -15,14 +15,19 @@ import { uploadOrganizationIcon } from "@/actions/organization/upload-organizati
1515export async function POST ( request : NextRequest ) {
1616 const user = await getCurrentUser ( ) ;
1717 const formData = await request . formData ( ) ;
18- const organizationName = String ( formData . get ( "organizationName" ) || "" ) ;
18+ const organizationName = String ( formData . get ( "organizationName" ) ) ;
1919 const organizationIcon = ( formData . get ( "icon" ) as FormDataEntryValue ) || null ;
2020
2121 if ( ! user ) {
2222 console . error ( "User not found" ) ;
2323 return NextResponse . json ( { error : true } , { status : 401 } ) ;
2424 }
2525
26+ if ( ! organizationName || organizationName . length === 0 ) {
27+ console . error ( "Organization name is required" ) ;
28+ return NextResponse . json ( { error : true } , { status : 400 } ) ;
29+ }
30+
2631 const organizationId = Organisation . OrganisationId . make ( nanoId ( ) ) ;
2732
2833 try {
You can’t perform that action at this time.
0 commit comments