mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 04:23:04 +00:00
Fixed an issue with redirect url
This commit is contained in:
@@ -54,13 +54,13 @@ export class AuthService {
|
|||||||
|
|
||||||
// If current route is different from the one setted in authentication guard
|
// If current route is different from the one setted in authentication guard
|
||||||
// and is not the login route, clear redirect url and messages
|
// and is not the login route, clear redirect url and messages
|
||||||
const routeUrlObs = this.store.select(routerStateSelector)
|
const routeUrl$ = this.store.select(routerStateSelector)
|
||||||
.filter((routerState: RouterReducerState) => isNotUndefined(routerState) && isNotUndefined(routerState.state))
|
.filter((routerState: RouterReducerState) => isNotUndefined(routerState) && isNotUndefined(routerState.state))
|
||||||
.filter((routerState: RouterReducerState) => !this.isLoginRoute(routerState.state.url))
|
.filter((routerState: RouterReducerState) => !this.isLoginRoute(routerState.state.url))
|
||||||
.map((routerState: RouterReducerState) => routerState.state.url);
|
.map((routerState: RouterReducerState) => routerState.state.url);
|
||||||
const redirectUrlObs = this.getRedirectUrl();
|
const redirectUrl$ = this.store.select(getRedirectUrl).distinctUntilChanged();
|
||||||
routeUrlObs.pipe(
|
routeUrl$.pipe(
|
||||||
withLatestFrom(redirectUrlObs),
|
withLatestFrom(redirectUrl$),
|
||||||
map(([routeUrl, redirectUrl]) => [routeUrl, redirectUrl])
|
map(([routeUrl, redirectUrl]) => [routeUrl, redirectUrl])
|
||||||
).filter(([routeUrl, redirectUrl]) => isNotEmpty(redirectUrl) && (routeUrl !== redirectUrl))
|
).filter(([routeUrl, redirectUrl]) => isNotEmpty(redirectUrl) && (routeUrl !== redirectUrl))
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
@@ -329,7 +329,6 @@ export class AuthService {
|
|||||||
this.getRedirectUrl()
|
this.getRedirectUrl()
|
||||||
.first()
|
.first()
|
||||||
.subscribe((redirectUrl) => {
|
.subscribe((redirectUrl) => {
|
||||||
console.log('Browser');
|
|
||||||
if (isNotEmpty(redirectUrl)) {
|
if (isNotEmpty(redirectUrl)) {
|
||||||
this.clearRedirectUrl();
|
this.clearRedirectUrl();
|
||||||
|
|
||||||
|
@@ -58,7 +58,6 @@ export class ServerAuthService extends AuthService {
|
|||||||
this.getRedirectUrl()
|
this.getRedirectUrl()
|
||||||
.first()
|
.first()
|
||||||
.subscribe((redirectUrl) => {
|
.subscribe((redirectUrl) => {
|
||||||
console.log('server side');
|
|
||||||
if (isNotEmpty(redirectUrl)) {
|
if (isNotEmpty(redirectUrl)) {
|
||||||
// override the route reuse strategy
|
// override the route reuse strategy
|
||||||
this.router.routeReuseStrategy.shouldReuseRoute = () => {
|
this.router.routeReuseStrategy.shouldReuseRoute = () => {
|
||||||
|
@@ -14,7 +14,6 @@ export class ServerCookieService extends CookieService implements ICookieService
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get(name: string): any {
|
public get(name: string): any {
|
||||||
console.log(this.req.connection.remoteAddress);
|
|
||||||
try {
|
try {
|
||||||
return JSON.parse(this.req.cookies[name])
|
return JSON.parse(this.req.cookies[name])
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Reference in New Issue
Block a user