mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-18 00:51:15 +00:00
feat(infisical-pg): changed frontend api types _id to normal id
This commit is contained in:
+6
-6
@@ -89,7 +89,7 @@ export const OrgRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
|
||||
const { createNotification } = useNotificationContext();
|
||||
const { currentOrg } = useOrganization();
|
||||
const orgId = currentOrg?._id || "";
|
||||
const orgId = currentOrg?.id || "";
|
||||
const {
|
||||
handleSubmit,
|
||||
register,
|
||||
@@ -105,12 +105,12 @@ export const OrgRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
const { mutateAsync: updateRole } = useUpdateRole();
|
||||
|
||||
const handleRoleUpdate = async (el: TFormSchema) => {
|
||||
if (!role?._id) return;
|
||||
if (!role?.id) return;
|
||||
|
||||
try {
|
||||
await updateRole({
|
||||
orgId,
|
||||
id: role?._id,
|
||||
id: role?.id,
|
||||
...el,
|
||||
permissions: formRolePermission2API(el.permissions)
|
||||
});
|
||||
@@ -145,7 +145,7 @@ export const OrgRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
||||
<div className="flex justify-between mb-2 items-center">
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<h1 className="text-xl font-semibold text-mineshaft-100">
|
||||
{isNewRole ? "New" : "Edit"} Role
|
||||
</h1>
|
||||
@@ -187,7 +187,7 @@ export const OrgRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
>
|
||||
<Input {...register("description")} isReadOnly={isNonEditable} />
|
||||
</FormControl>
|
||||
<div className="flex justify-between items-center pt-6 border-t border-t-mineshaft-800">
|
||||
<div className="flex items-center justify-between border-t border-t-mineshaft-800 pt-6">
|
||||
<div>
|
||||
<h2 className="text-xl font-medium">Add Permission</h2>
|
||||
</div>
|
||||
@@ -213,7 +213,7 @@ export const OrgRoleModifySection = ({ role, onGoBack }: Props) => {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="flex items-center space-x-4 mt-12">
|
||||
<div className="mt-12 flex items-center space-x-4">
|
||||
<Button
|
||||
type="submit"
|
||||
isDisabled={isSubmitting || isNonEditable || !isDirty}
|
||||
|
||||
@@ -27,12 +27,10 @@ type Props = {
|
||||
onSelectRole: (role?: TRole<undefined>) => void;
|
||||
};
|
||||
|
||||
export const OrgRoleTable = ({
|
||||
onSelectRole
|
||||
}: Props) => {
|
||||
export const OrgRoleTable = ({ onSelectRole }: Props) => {
|
||||
const [searchRoles, setSearchRoles] = useState("");
|
||||
const { currentOrg } = useOrganization();
|
||||
const orgId = currentOrg?._id || "";
|
||||
const orgId = currentOrg?.id || "";
|
||||
const { createNotification } = useNotificationContext();
|
||||
const { popUp, handlePopUpOpen, handlePopUpClose } = usePopUp(["deleteRole"] as const);
|
||||
|
||||
@@ -43,7 +41,7 @@ export const OrgRoleTable = ({
|
||||
const { mutateAsync: deleteRole } = useDeleteRole();
|
||||
|
||||
const handleRoleDelete = async () => {
|
||||
const { _id: id } = popUp?.deleteRole?.data as TRole<undefined>;
|
||||
const { id } = popUp?.deleteRole?.data as TRole<undefined>;
|
||||
try {
|
||||
await deleteRole({
|
||||
orgId,
|
||||
@@ -93,7 +91,7 @@ export const OrgRoleTable = ({
|
||||
<TBody>
|
||||
{isRolesLoading && <TableSkeleton columns={4} innerKey="org-roles" />}
|
||||
{(roles as TRole<undefined>[])?.map((role) => {
|
||||
const { _id: id, name, slug } = role;
|
||||
const { id, name, slug } = role;
|
||||
const isNonMutatable = ["owner", "admin", "member", "no-access"].includes(slug);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user