Skip to content

Commit

Permalink
alow for updateing group info
Browse files Browse the repository at this point in the history
  • Loading branch information
ganning127 authored and lahirujayathilake committed Sep 13, 2024
1 parent 2cfc8d1 commit 646d5eb
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion veda-auth-portal/src/components/Groups/GroupSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,46 @@ export const GroupSettings = ({ groupId }: GroupSettingsProps) => {
})();
}, []);

const handleSaveChanges = async() => {
console.log(name, description);

const resp = await customFetch(
`${BACKEND_URL}/api/v1/group-management/groups/${groupId}`,
{
method: "PUT",
body: JSON.stringify({
name,
description
}),
headers: {
"Content-Type": "application/json"
}
}
);

console.log(resp);

if (resp?.id) {
// was successful
navigate(0);
} else {
toast({
title: 'Could not save group',
status: 'error',
duration: 3000,
isClosable: true,
});
}


}

if (!groupId) {
return;
}



return (
<>
<PageTitle size="md">Group Settings</PageTitle>
Expand Down Expand Up @@ -297,7 +333,7 @@ export const GroupSettings = ({ groupId }: GroupSettingsProps) => {
</Stack>

<Stack direction="row" mt={8} spacing={4}>
<ActionButton onClick={() => {}}>Save Changes</ActionButton>
<ActionButton onClick={handleSaveChanges}>Save Changes</ActionButton>

<ActionButton
onClick={transferOwnershipDisclosure.onOpen}
Expand Down

0 comments on commit 646d5eb

Please sign in to comment.