Skip to content

Commit 73bc732

Browse files
committed
minor refinements
1 parent 7da87fe commit 73bc732

File tree

2 files changed

+8
-2
lines changed
  • apps/web/app
    • (org)/onboarding/organization-setup
    • api/settings/onboarding/org-setup

2 files changed

+8
-2
lines changed

apps/web/app/(org)/onboarding/organization-setup/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

apps/web/app/api/settings/onboarding/org-setup/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ import { uploadOrganizationIcon } from "@/actions/organization/upload-organizati
1515
export 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 {

0 commit comments

Comments
 (0)