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 = []; this.rows = [];
} }
changeUrl(apiUrl: string) {
this.apiUrl = apiUrl;
}
updateSubs() { updateSubs() {
this.subs.forEach(x => x(this)); this.subs.forEach(x => x(this));
} }

View File

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