Add SimpleRedirect to parseRedirect.

This commit is contained in:
Bauke 2022-10-18 18:59:05 +02:00
parent b54d6ab0c2
commit 1743959769
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 7 additions and 1 deletions

View File

@ -10,7 +10,13 @@ export type Redirects = HostnameRedirect | SimpleRedirect;
export function parseRedirect<P extends Redirects['parameters']>( export function parseRedirect<P extends Redirects['parameters']>(
parameters: P, parameters: P,
): Redirects | undefined { ): Redirects | undefined {
if (parameters?.type === 'hostname') { const type = parameters?.type;
if (type === 'hostname') {
return new HostnameRedirect(parameters); return new HostnameRedirect(parameters);
} }
if (type === 'simple') {
return new SimpleRedirect(parameters);
}
} }