You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/06/05 14:38:50 UTC

[incubator-apisix-dashboard] branch next updated: fix: typing for Route

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git


The following commit(s) were added to refs/heads/next by this push:
     new 7fd8563  fix: typing for Route
7fd8563 is described below

commit 7fd856321e7dabfe841594603ae144af6fbd3909
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Fri Jun 5 22:38:26 2020 +0800

    fix: typing for Route
---
 src/pages/Routes/transform.ts | 6 +++---
 src/pages/Routes/typing.d.ts  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/pages/Routes/transform.ts b/src/pages/Routes/transform.ts
index 6b7a813..1f42668 100644
--- a/src/pages/Routes/transform.ts
+++ b/src/pages/Routes/transform.ts
@@ -120,10 +120,10 @@ export const transformRouteData = (data: RouteModule.Body) => {
     paths: uris,
     methods,
     advancedMatchingRules: transformVarsToRules(vars),
-    forceHttps: Boolean(redirect.http_to_https),
+    forceHttps: Boolean(redirect?.http_to_https),
   };
 
-  if (redirect.uri) {
+  if (redirect?.uri) {
     step1Data.redirectCode = redirect.code;
     step1Data.redirectURI = redirect.uri;
   }
@@ -143,7 +143,7 @@ export const transformRouteData = (data: RouteModule.Body) => {
     upstream_protocol,
     upstreamHeaderList,
     upstreamHostList: transformUpstreamNodes(upstream.nodes),
-    upstreamPath: upstream_path.to,
+    upstreamPath: upstream_path?.to,
     timeout: upstream.timeout,
   };
 
diff --git a/src/pages/Routes/typing.d.ts b/src/pages/Routes/typing.d.ts
index 98b921c..6b42531 100644
--- a/src/pages/Routes/typing.d.ts
+++ b/src/pages/Routes/typing.d.ts
@@ -95,7 +95,7 @@ declare namespace RouteModule {
     uris: string[];
     hosts: string[];
     protocols: RequestProtocol[];
-    redirect: Redirect;
+    redirect?: Redirect;
     vars: [string, Operator, string][];
     upstream: {
       type: 'roundrobin' | 'chash';
@@ -108,7 +108,7 @@ declare namespace RouteModule {
         read: number;
       };
     };
-    upstream_path: {
+    upstream_path?: {
       from?: string;
       to: string;
     };