Fix people creation redirect to a not found page

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-10 15:12:58 +01:00
parent 7d80557d71
commit 1070bba627

View File

@@ -89,7 +89,7 @@ function CreatePeoplePageContent() {
e.preventDefault(); e.preventDefault();
const peopleConnectionId = ConnectionHandler.getConnectionID( const peopleConnectionId = ConnectionHandler.getConnectionID(
organizationId!, organizationId!,
"PeopleListPage_peoples", "PeopleListPage_peoples"
); );
createPeople({ createPeople({
@@ -109,7 +109,9 @@ function CreatePeoplePageContent() {
description: "Person created successfully", description: "Person created successfully",
variant: "default", variant: "default",
}); });
navigate(`/peoples/${response.createPeople.peopleEdge.node.id}`); navigate(
`/organizations/${organizationId}/peoples/${response.createPeople.peopleEdge.node.id}`
);
}, },
onError: (error) => { onError: (error) => {
toast({ toast({
@@ -165,7 +167,7 @@ function CreatePeoplePageContent() {
newEmails[index] = e.target.value; newEmails[index] = e.target.value;
handleFieldChange( handleFieldChange(
"additionalEmailAddresses", "additionalEmailAddresses",
newEmails, newEmails
); );
}} }}
/> />
@@ -175,11 +177,11 @@ function CreatePeoplePageContent() {
onClick={() => { onClick={() => {
const newEmails = const newEmails =
formData.additionalEmailAddresses.filter( formData.additionalEmailAddresses.filter(
(_, i) => i !== index, (_, i) => i !== index
); );
handleFieldChange( handleFieldChange(
"additionalEmailAddresses", "additionalEmailAddresses",
newEmails, newEmails
); );
}} }}
> >
@@ -227,7 +229,7 @@ function CreatePeoplePageContent() {
"rounded-full px-4 py-1 text-sm transition-colors", "rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "EMPLOYEE" formData.kind === "EMPLOYEE"
? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2" ? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200", : "bg-gray-100 text-gray-900 hover:bg-gray-200"
)} )}
> >
Employee Employee
@@ -239,7 +241,7 @@ function CreatePeoplePageContent() {
"rounded-full px-4 py-1 text-sm transition-colors", "rounded-full px-4 py-1 text-sm transition-colors",
formData.kind === "CONTRACTOR" formData.kind === "CONTRACTOR"
? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2" ? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2"
: "bg-gray-100 text-gray-900 hover:bg-gray-200", : "bg-gray-100 text-gray-900 hover:bg-gray-200"
)} )}
> >
Contractor Contractor