1
0

fix issue where a hard refresh wouldn't work to clear the state due to the browser caching the html

This commit is contained in:
Art Lowel
2020-04-24 13:16:52 +02:00
parent a6d7b6444c
commit c2789dfbf7
3 changed files with 22 additions and 3 deletions

View File

@@ -60,6 +60,7 @@ export function getDSOPath(dso: DSpaceObject): string {
imports: [ imports: [
RouterModule.forRoot([ RouterModule.forRoot([
{ path: '', redirectTo: '/home', pathMatch: 'full' }, { path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'reload/:rnd', redirectTo: '/home', pathMatch: 'full' },
{ path: 'home', loadChildren: './+home-page/home-page.module#HomePageModule', data: { showBreadcrumbs: false } }, { path: 'home', loadChildren: './+home-page/home-page.module#HomePageModule', data: { showBreadcrumbs: false } },
{ path: 'community-list', loadChildren: './community-list-page/community-list-page.module#CommunityListPageModule' }, { path: 'community-list', loadChildren: './community-list-page/community-list-page.module#CommunityListPageModule' },
{ path: 'id', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule' }, { path: 'id', loadChildren: './+lookup-by-id/lookup-by-id.module#LookupIdModule' },

View File

@@ -1,4 +1,5 @@
import { StoreActionTypes } from './store.actions'; import { StoreActionTypes } from './store.actions';
import { AuthActionTypes } from './core/auth/auth.actions';
// fallback ngrx debugger // fallback ngrx debugger
let actionCounter = 0; let actionCounter = 0;
@@ -28,10 +29,26 @@ export function universalMetaReducer(reducer) {
} }
} }
// const clearStateActions = [
// AuthActionTypes.LOG_OUT_SUCCESS,
// ];
//
// export function clearStateMetaReducer(reducer) {
// return function (state, action) {
//
// if (clearStateActions.includes(action.type)) {
// state = {};
// }
//
// return reducer(state, action);
// };
// }
export const debugMetaReducers = [ export const debugMetaReducers = [
debugMetaReducer debugMetaReducer
]; ];
export const appMetaReducers = [ export const appMetaReducers = [
universalMetaReducer universalMetaReducer,
// clearStateMetaReducer
]; ];

View File

@@ -460,8 +460,9 @@ export class AuthService {
* Refresh route navigated * Refresh route navigated
*/ */
public refreshAfterLogout() { public refreshAfterLogout() {
// Hard redirect to home page, so that all state is definitely lost // Hard redirect to the reload page with a unique number behind it
this._window.nativeWindow.location.href = '/home'; // so that all state is definitely lost
this._window.nativeWindow.location.href = `/reload/${new Date().getTime()}`;
} }
/** /**