Add abstract getter & setters for the redirect value.

This commit is contained in:
Bauke 2022-10-18 22:00:42 +02:00
parent a4b12334c5
commit e2d233f8d6
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 20 additions and 0 deletions

View File

@ -33,4 +33,8 @@ export abstract class Redirect<P extends RedirectParameters> {
} }
public abstract redirect(url: URL | string): URL; public abstract redirect(url: URL | string): URL;
public abstract get redirectValue(): string;
public abstract set redirectValue(value: string);
} }

View File

@ -11,4 +11,12 @@ export class HostnameRedirect extends Redirect<HostnameParameters> {
redirected.hostname = this.parameters.hostname; redirected.hostname = this.parameters.hostname;
return redirected; return redirected;
} }
public get redirectValue(): string {
return this.parameters.hostname;
}
public set redirectValue(value: string) {
this.parameters.hostname = value;
}
} }

View File

@ -9,4 +9,12 @@ export class SimpleRedirect extends Redirect<SimpleParameters> {
public redirect(): URL { public redirect(): URL {
return new URL(this.parameters.target); return new URL(this.parameters.target);
} }
public get redirectValue(): string {
return this.parameters.target;
}
public set redirectValue(value: string) {
this.parameters.target = value;
}
} }