Sfoglia il codice sorgente

fix: redirect with deploy on non-root path (#8141)

云深 4 anni fa
parent
commit
d9d8d4fa6e
2 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 3 0
      src/models/login.ts
  2. 1 0
      src/typings.d.ts

+ 3 - 0
src/models/login.ts

@@ -49,6 +49,9 @@ const Model: LoginModelType = {
           const redirectUrlParams = new URL(redirect);
           if (redirectUrlParams.origin === urlParams.origin) {
             redirect = redirect.substr(urlParams.origin.length);
+            if (window.routerBase !== '/') {
+              redirect = redirect.replace(window.routerBase, '/');
+            }
             if (redirect.match(/^\/.*#/)) {
               redirect = redirect.substr(redirect.indexOf('#') + 1);
             }

+ 1 - 0
src/typings.d.ts

@@ -33,6 +33,7 @@ interface Window {
     fieldsObject: GAFieldsObject | string,
   ) => void;
   reloadAuthorized: () => void;
+  routerBase: string;
 }
 
 declare let ga: () => void;