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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1cb7cb0  fix: redirect uri when session expired (#2044)
1cb7cb0 is described below

commit 1cb7cb015f68531f62fe0105efe28ac559e0f9a2
Author: foolwc <[email protected]>
AuthorDate: Mon Aug 9 18:26:06 2021 +0800

    fix: redirect uri when session expired (#2044)
---
 .../pluginTemplate/create-plugin-template-with-route.spec.js         | 1 +
 web/src/app.tsx                                                      | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
 
b/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
index 83954d5..5c2f669 100644
--- 
a/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
+++ 
b/web/cypress/integration/pluginTemplate/create-plugin-template-with-route.spec.js
@@ -77,6 +77,7 @@ context('Create PluginTemplate Binding To Route', () => {
     cy.get(selector.nodes_0_port).clear().type(data.port);
     cy.get(selector.nodes_0_weight).clear().type(data.weight);
     cy.contains('Next').click();
+    cy.scrollTo(0, 0);
     cy.contains('Custom').should('be.visible');
     cy.get(selector.customSelector).click();
     cy.contains(data.pluginTemplateName).click();
diff --git a/web/src/app.tsx b/web/src/app.tsx
index 421febe..6c3a553 100644
--- a/web/src/app.tsx
+++ b/web/src/app.tsx
@@ -23,7 +23,7 @@ import { isPlainObject } from 'lodash';
 import RightContent from '@/components/RightContent';
 import Footer from '@/components/Footer';
 import { queryCurrent } from '@/services/user';
-import { getMenuData, errorHandler } from '@/helpers';
+import { getMenuData, errorHandler, getUrlQuery } from '@/helpers';
 
 import './libs/iconfont';
 import defaultSettings from '../config/defaultSettings';
@@ -34,7 +34,8 @@ export async function getInitialState(): Promise<{
 }> {
   const token = localStorage.getItem('token');
   if (!token) {
-    
history.replace(`/user/login?redirect=${encodeURIComponent(window.location.pathname)}`);
+    const redirect = getUrlQuery('redirect') || '/';
+    history.replace(`/user/login?redirect=${redirect}`);
   }
 
   const currentUser = await queryCurrent();

Reply via email to