Skip to content

Commit

Permalink
fix: fix the wrong delete organization function parameter (#952)
Browse files Browse the repository at this point in the history
Because

- The delete organization function parameter naming is wronf

This commit

- fix the wrong delete organization function parameter
  • Loading branch information
EiffelFly committed Feb 14, 2024
1 parent 20d0793 commit 8e2d89f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ export function useDeleteOrganization() {
const queryClient = useQueryClient();
return useMutation(
async ({
organizationName,
organizationID,
accessToken,
}: {
organizationName: Nullable<string>;
organizationID: Nullable<string>;
accessToken: Nullable<string>;
}) => {
if (!accessToken) {
return Promise.reject(new Error("AccessToken not provided"));
}
if (!organizationName) {
return Promise.reject(new Error("Organization Name not provided"));
if (!organizationID) {
return Promise.reject(new Error("organizationID not provided"));
}

await deleteOrganizationMutation({ organizationName, accessToken });
await deleteOrganizationMutation({ organizationID, accessToken });

return Promise.resolve(organizationName);
return Promise.resolve(organizationID);
},
{
onSuccess: (organizationName) => {
onSuccess: (organizationID) => {
queryClient.setQueryData<Organization[]>(["organizations"], (old) =>
old ? old.filter((e) => e.id !== organizationName) : []
old ? old.filter((e) => e.id !== organizationID) : []
);
},
}
Expand Down
6 changes: 3 additions & 3 deletions packages/toolkit/src/lib/vdp-sdk/organization/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ export async function updateOrganizationMembershipMutation({
}

export async function deleteOrganizationMutation({
organizationName,
organizationID,
accessToken,
}: {
organizationName: string;
organizationID: string;
accessToken: Nullable<string>;
}) {
try {
const client = createInstillAxiosClient(accessToken, "core");

await client.delete(`/organizations/${organizationName}`);
await client.delete(`/organizations/${organizationID}`);
} catch (err) {
return Promise.reject(err);
}
Expand Down

0 comments on commit 8e2d89f

Please sign in to comment.