Skip to content

Commit b5e17ba

Browse files
committed
Navigate to the members page when a user clicks the Organization Members button
1 parent a83f6d2 commit b5e17ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/ui/dashboard/create-entity.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@ import { useState } from "react";
44
import { AddCoachingSessionDialog } from "./add-coaching-session-dialog";
55
import { AddCoachingSessionButton } from "./add-coaching-session-button";
66
import { AddMemberButton } from "./add-member-button";
7+
import { useRouter } from "next/navigation";
8+
import { useOrganizationStateStore } from "@/lib/providers/organization-state-store-provider";
79

810
export default function CreateEntity() {
11+
const router = useRouter();
912
const [open, setOpen] = useState(false);
13+
const { currentOrganizationId } = useOrganizationStateStore((state) => state);
1014

1115
const onCoachingSessionAdded = () => {
1216
setOpen(false);
1317
};
1418

19+
const onMemberButtonClicked = () => {
20+
router.push(`/organizations/${currentOrganizationId}/members`);
21+
};
22+
1523
return (
1624
<div className="space-y-4">
1725
<h2 className="text-2xl font-bold tracking-tight">Create</h2>
@@ -23,7 +31,7 @@ export default function CreateEntity() {
2331
dialogTrigger={<AddCoachingSessionButton />}
2432
/>
2533

26-
<AddMemberButton />
34+
<AddMemberButton onClick={onMemberButtonClicked} />
2735
</div>
2836
</div>
2937
);

0 commit comments

Comments
 (0)