[FIX] the add base path in reload
This commit is contained in:
parent
5340a71776
commit
3f871e406a
@ -47,7 +47,7 @@ export class SSOService {
|
|||||||
) {
|
) {
|
||||||
return this.utf8_to_b64(data);
|
return this.utf8_to_b64(data);
|
||||||
}
|
}
|
||||||
const pathName = getApplicationLocation();
|
const pathName = getApplicationLocation(this.environment);
|
||||||
if (isInArray(pathName, ['sso', '/sso', '/sso/'])) {
|
if (isInArray(pathName, ['sso', '/sso', '/sso/'])) {
|
||||||
return this.utf8_to_b64('home');
|
return this.utf8_to_b64('home');
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import { SSOService } from './sso';
|
|||||||
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
|
import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils';
|
||||||
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf';
|
||||||
import { Environment } from '../model/environment';
|
import { Environment } from '../model/environment';
|
||||||
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -76,7 +77,7 @@ export class UserService {
|
|||||||
* Check if the system can be connected
|
* Check if the system can be connected
|
||||||
*/
|
*/
|
||||||
checkAutoConnect(): Promise<void> {
|
checkAutoConnect(): Promise<void> {
|
||||||
let locationOrigin = getApplicationLocation();
|
let locationOrigin = getApplicationLocation(this.environment);
|
||||||
const self = this;
|
const self = this;
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
// Need to use the windows global route to prevent the log in cycle ...
|
// Need to use the windows global route to prevent the log in cycle ...
|
||||||
@ -91,7 +92,7 @@ export class UserService {
|
|||||||
}
|
}
|
||||||
console.log(' ==> Check if need reconnect?');
|
console.log(' ==> Check if need reconnect?');
|
||||||
let rememberMe = self.getRememberMe();
|
let rememberMe = self.getRememberMe();
|
||||||
// TODO: in case of jest reload ==> no need to manage the SSO ==> just keep the token ... it in enought...
|
// TODO: in case of jest reload ==> no need to manage the SSO ==> just keep the token ... it in enough...
|
||||||
let token: undefined | string = undefined;
|
let token: undefined | string = undefined;
|
||||||
if (
|
if (
|
||||||
isNullOrUndefined(this.environment.tokenStoredInPermanentStorage) ||
|
isNullOrUndefined(this.environment.tokenStoredInPermanentStorage) ||
|
||||||
@ -109,7 +110,7 @@ export class UserService {
|
|||||||
self.startSession(token ?? '', rememberMe)
|
self.startSession(token ?? '', rememberMe)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
self.router.navigateByUrl(locationOrigin);
|
self.router.navigateByUrl(locationOrigin);
|
||||||
console.log(`update global URL = ${locationOrigin}`);
|
console.log(`update global URL = ${locationOrigin} APP_BASE_HREF=${APP_BASE_HREF}`);
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
//import { environment } from 'environments/environment';
|
//import { environment } from 'environments/environment';
|
||||||
|
|
||||||
export function getApplicationLocation(): string {
|
import { Environment } from "../model";
|
||||||
|
|
||||||
|
export function getApplicationLocation(environment: Environment): string {
|
||||||
let pathName = location.pathname;
|
let pathName = location.pathname;
|
||||||
return pathName;
|
|
||||||
//console.log("start Path-name: '" + pathName + "'");
|
//console.log("start Path-name: '" + pathName + "'");
|
||||||
//console.log("check with: '" + environment.applName + "/sso/" + "'");
|
//console.log("check with: '" + environment.applName + "/sso/" + "'");
|
||||||
/*
|
|
||||||
|
|
||||||
if (pathName.startsWith('/' + environment.applName + '/')) {
|
if (pathName.startsWith('/' + environment.applName + '/')) {
|
||||||
pathName = pathName.substring(environment.applName.length + 2);
|
pathName = pathName.substring(environment.applName.length + 2);
|
||||||
} else if (pathName.startsWith('/' + environment.applName)) {
|
} else if (pathName.startsWith('/' + environment.applName)) {
|
||||||
@ -17,5 +16,4 @@ export function getApplicationLocation(): string {
|
|||||||
pathName = pathName.substring(environment.applName.length);
|
pathName = pathName.substring(environment.applName.length);
|
||||||
}
|
}
|
||||||
return pathName;
|
return pathName;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user