Skip to content

Commit

Permalink
migrate useDeleteOrgAuthProviderMutation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Nov 13, 2023
1 parent d389218 commit 4139a8c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

import { useMutation, useQueryClient } from "@tanstack/react-query";
import { getGitpodService } from "../../service/service";
import { useCurrentOrg } from "../organizations/orgs-query";
import { getOrgAuthProvidersQueryKey, OrgAuthProvidersQueryResult } from "./org-auth-providers-query";
import { authProviderClient } from "../../service/public-api";
import { DeleteAuthProviderRequest } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb";

type DeleteAuthProviderArgs = {
providerId: string;
Expand All @@ -22,10 +23,13 @@ export const useDeleteOrgAuthProviderMutation = () => {
throw new Error("No current organization selected");
}

return await getGitpodService().server.deleteOrgAuthProvider({
id: providerId,
organizationId: organization.id,
});
const response = await authProviderClient.deleteAuthProvider(
new DeleteAuthProviderRequest({
authProviderId: providerId,
}),
);

return response;
},
onSuccess: (_, { providerId }) => {
if (!organization) {
Expand Down

0 comments on commit 4139a8c

Please sign in to comment.