From c513a3cc5ad0f4797140ac7f66ac8180e67097d4 Mon Sep 17 00:00:00 2001 From: gjudic Date: Wed, 6 Jan 2021 22:38:26 +0100 Subject: [PATCH] Errors matters and order of refresh too --- myDNS.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/myDNS.js b/myDNS.js index 482f199..ed6f5fc 100644 --- a/myDNS.js +++ b/myDNS.js @@ -15,11 +15,24 @@ var ovh = require('ovh')({ ovh.request('PUT', '/domain/zone/' + element.domain + '/record/' + element.id, { target : myip }, function (err, result) { - console.log(err || result); - console.log("Le domaine " + element.domain + " a ete match avec l'IP " + myip); - }); - ovh.request('POST', '/domain/zone/' + element.domain + '/refresh', function (err, result) { - console.log(err || result); + if(err == null || result == null) + { + console.log("Le domaine " + element.domain + " a ete match avec l'IP " + myip); + ovh.request('POST', '/domain/zone/' + element.domain + '/refresh', function (err, result) { + if(err == null || result == null) + { + console.log("Le domaine " + element.domain + " a ete refresh"); + } + else + { + console.log(err || result); + } + }); + } + else + { + console.log(err || result); + } }); }); })(); \ No newline at end of file