simplify 'push dns records' callback

This commit is contained in:
axolotle 2021-09-29 16:06:05 +02:00
parent 64ae24facd
commit 038ad92f00

View file

@ -124,7 +124,9 @@ export default {
}, },
getDnsChanges () { getDnsChanges () {
api.post( this.loading = true
return api.post(
`domains/${this.name}/dns/push?dry_run`, {}, null, { wait: false, websocket: false } `domains/${this.name}/dns/push?dry_run`, {}, null, { wait: false, websocket: false }
).then(dnsChanges => { ).then(dnsChanges => {
function getLongest (arr, key) { function getLongest (arr, key) {
@ -196,12 +198,9 @@ export default {
`domains/${this.name}/dns/push${this.force ? '?force' : ''}`, `domains/${this.name}/dns/push${this.force ? '?force' : ''}`,
{}, {},
{ key: 'domains.push_dns_changes', name: this.name } { key: 'domains.push_dns_changes', name: this.name }
).then(responseData => { ).then(async responseData => {
if (isEmptyValue(responseData)) { await this.getDnsChanges()
this.dnsChanges = null if (!isEmptyValue(responseData)) {
} else {
this.loading = true
this.getDnsChanges()
this.dnsErrors = Object.keys(responseData).reduce((acc, key) => { this.dnsErrors = Object.keys(responseData).reduce((acc, key) => {
const args = key === 'warnings' const args = key === 'warnings'
? { icon: 'warning', variant: 'warning' } ? { icon: 'warning', variant: 'warning' }