1
0
Fork 0

Update src/commands/cwg.ts

refactor/models
Matthew 2019-10-30 11:51:48 -04:00
parent 0683424862
commit 0c9160a196
1 changed files with 3 additions and 1 deletions

View File

@ -126,12 +126,14 @@ export default class CWG extends Command {
}); });
this.client.signale.debug(resultID.data); this.client.signale.debug(resultID.data);
const recordID = resultID.data.result[0].id; const recordID = resultID.data.result[0].id;
if (resultID.data.result[0]) {
await axios({ await axios({
method: 'delete', method: 'delete',
url: `https://api.cloudflare.com/client/v4/zones/5e82fc3111ed4fbf9f58caa34f7553a7/dns_records/${recordID}`, url: `https://api.cloudflare.com/client/v4/zones/5e82fc3111ed4fbf9f58caa34f7553a7/dns_records/${recordID}`,
headers: { Authorization: `Bearer ${this.client.config.cloudflare}` }, headers: { Authorization: `Bearer ${this.client.config.cloudflare}` },
}); });
} }
}
await fs.unlink(`/etc/nginx/sites-available/${domain.domain}`); await fs.unlink(`/etc/nginx/sites-available/${domain.domain}`);
await fs.unlink(`/etc/nginx/sites-enabled/${domain.domain}`); await fs.unlink(`/etc/nginx/sites-enabled/${domain.domain}`);
await this.client.db.Domain.deleteOne({ domain: domain.domain }); await this.client.db.Domain.deleteOne({ domain: domain.domain });