diff options
Diffstat (limited to '_www')
| -rw-r--r-- | _www/rescached.js | 29 | ||||
| -rw-r--r-- | _www/zone.d/index.html | 4 |
2 files changed, 15 insertions, 18 deletions
diff --git a/_www/rescached.js b/_www/rescached.js index a821081..0be344a 100644 --- a/_www/rescached.js +++ b/_www/rescached.js @@ -27,6 +27,7 @@ const contentTypeForm = "application/x-www-form-urlencoded" const contentTypeJson = "application/json" const paramNameName = "name" +const paramNameZone = "zone" const headerContentType = "Content-Type" @@ -295,9 +296,9 @@ class Rescached { async ZonedRecordAdd(name, rr) { let req = { - "zone": name, - "type": getRRTypeName(rr.Type), - "record": btoa(JSON.stringify(rr)), + zone: name, + type: getRRTypeName(rr.Type), + record: btoa(JSON.stringify(rr)), } const httpRes = await fetch(Rescached.apiZonedRR, { @@ -322,23 +323,21 @@ class Rescached { return res } - async ZoneFileRecordDelete(name, rr) { - let api = - this.server + - Rescached.apiZoned + - name + - "/rr/" + - rr.Type + async ZonedRecordDelete(zone, rr) { + let params = new URLSearchParams() + params.set(paramNameZone, zone) + params.set("type", getRRTypeName(rr.Type)) + params.set("record", btoa(JSON.stringify(rr))) + + let api = Rescached.apiZonedRR + "?" + params.toString() + const httpRes = await fetch(api, { method: "DELETE", - headers: { - [headerContentType]: contentTypeJson, - }, - body: JSON.stringify(rr), }) + let res = await httpRes.json() if (httpRes.status === 200) { - this.env.Zones[name].Records = res.data + this.env.Zones[zone].Records = res.data } return res } diff --git a/_www/zone.d/index.html b/_www/zone.d/index.html index d6bc2a2..bb733e8 100644 --- a/_www/zone.d/index.html +++ b/_www/zone.d/index.html @@ -364,13 +364,11 @@ async function deleteRR(name, idx) { let rr = activeZone.Records[name][idx] - console.log("deleteRR: ", rr) - let res = await resc.ZoneFileRecordDelete(activeZone.Name, rr) + let res = await resc.ZonedRecordDelete(activeZone.Name, rr) if (res.code != 200) { notifError(res.message) return } - activeZone.Records = res.data renderActiveZoneRecords() notifInfo(res.message) } |
