Change domain name in rest queries

This commit is contained in:
Melon 2024-08-02 20:37:33 +01:00
parent e2615861b0
commit cb25cf000a
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
2 changed files with 9 additions and 2 deletions

View File

@ -16,6 +16,10 @@ export class RestTable<T extends object> implements IPromiseLike<RestTable<T>> {
this.rows = [];
}
changeUrl(apiUrl: string) {
this.apiUrl = apiUrl;
}
updateSubs() {
this.subs.forEach(x => x(this));
}

View File

@ -1,7 +1,6 @@
<script lang="ts">
import {domainOption} from "../stores/domain-option";
import {
DnsTypeA,
DnsTypeCAA,
DnsTypeCNAME,
DnsTypeMX,
@ -26,7 +25,6 @@
type CnameValue,
type MxValue,
type NsValue,
type SoaValue,
type SrvValue,
type TxtValue,
} from "../types/records";
@ -51,6 +49,11 @@
const table = new RestTable<AnyRecord>(apiAzalea + "/domains/" + $domainOption + "/records", (item: AnyRecord) => item.name);
domainOption.subscribe(x => {
table.changeUrl(apiAzalea + "/domains/" + x + "/records");
table.reload();
});
function rowOrdering<T extends AnyValue>(
rows: RestItem<AnyRecord>[],
domain: string,