Skip to content

Commit

Permalink
MOBILE-4405 site, auth: Add redirectPath when session expires
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonso-salces committed Sep 1, 2023
1 parent c5e541f commit 5ad6e88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/classes/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { SQLiteDB } from '@classes/sqlitedb';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreLogger } from '@singletons/logger';
import { Translate } from '@singletons';
import { Router, Translate } from '@singletons';
import { CoreIonLoadingElement } from './ion-loading';
import { CoreLang, CoreLangFormat } from '@services/lang';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
Expand Down Expand Up @@ -835,7 +835,7 @@ export class CoreSite {

if (CoreUtils.isExpiredTokenError(error)) {
// Session expired, trigger event.
CoreEvents.trigger(CoreEvents.SESSION_EXPIRED, {}, this.id);
CoreEvents.trigger(CoreEvents.SESSION_EXPIRED, { redirectPath: Router.url }, this.id);
// Change error message. Try to get data from cache, the event will handle the error.
error.message = Translate.instant('core.lostconnection');
useSilentError = true; // Use a silent error, the SESSION_EXPIRED event will display a message if needed.
Expand Down
2 changes: 1 addition & 1 deletion src/core/features/mainmenu/guards/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class CoreMainMenuAuthGuard implements CanLoad, CanActivate {
return Router.parseUrl('/login');
}

if (CoreLoginHelper.isSiteLoggedOut()) {
if (CoreLoginHelper.isSiteLoggedOut({ redirectPath: Router.url })) {
// Send the user to reconnect page.
const newRoute = Router.parseUrl('/login/reconnect');
const siteId = CoreSites.getCurrentSiteId();
Expand Down

0 comments on commit 5ad6e88

Please sign in to comment.