Skip to content

Commit

Permalink
fix(admin): remove certificate create on domain setup mobilization
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Jan 13, 2025
1 parent b7a0a52 commit b583beb
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,6 @@ export const FormPanel: React.FC<FormPanelProperties> = ({
}
`
);
const [createOrUpdateCertificate] = useMutation(
gql`
mutation ($dns_hosted_zone_id: Int!) {
create_or_update_certificate(dns_hosted_zone_id: $dns_hosted_zone_id) {
id
is_active
domain
dns_hosted_zone_id
}
}
`
);

const onSubmit = async ({ customDomain, isExternalDomain = false }: { customDomain: string, isExternalDomain?: boolean }) => {
try {
Expand Down Expand Up @@ -135,18 +123,8 @@ export const FormPanel: React.FC<FormPanelProperties> = ({

const { data: { update_mobilizations_by_pk } } = await updateMobilization({ variables: { id: mobilization.id, customDomain: `www.${customDomain}` } });

// update certificate is the final request because make a fetch customDomains
let certificate;
if (hostedZone?.ns_ok && !isExternalDomain) {
const { data } = await createOrUpdateCertificate({ variables: { dns_hosted_zone_id: hostedZone.id } });
certificate = data?.create_or_update_certificate;
}

updateDomain && updateDomain(
{
...hostedZone,
certificates: certificate ? [certificate] : []
},
{ ...hostedZone },
{ ...mobilization, ...update_mobilizations_by_pk }
);
toast({ title: 'Domínio registrado com sucesso!', status: 'success', isClosable: true });
Expand Down

0 comments on commit b583beb

Please sign in to comment.