initialization of logout is modified
This commit is contained in:
parent
44e576fc72
commit
81c3cbe43a
@ -66,6 +66,10 @@ export const logoutConfirmationDismiss = createAction(
|
|||||||
'[Account::Authentication] Logout Confirmation Dismiss'
|
'[Account::Authentication] Logout Confirmation Dismiss'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const logoutInitialize = createAction(
|
||||||
|
'[Account::Authentication] Logout Initialize'
|
||||||
|
);
|
||||||
|
|
||||||
export const postLogin = createAction(
|
export const postLogin = createAction(
|
||||||
'[Account::Authentication] Post Login',
|
'[Account::Authentication] Post Login',
|
||||||
props<{
|
props<{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable, Inject, NgZone } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { of, Observable } from 'rxjs';
|
import { of, Observable } from 'rxjs';
|
||||||
@ -36,7 +36,8 @@ import {
|
|||||||
changePasswordFailure,
|
changePasswordFailure,
|
||||||
changePasswordSuccess,
|
changePasswordSuccess,
|
||||||
increaseLoginFailCount,
|
increaseLoginFailCount,
|
||||||
initialLoginFailCount
|
initialLoginFailCount,
|
||||||
|
logoutInitialize
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import {
|
import {
|
||||||
LoginInfo,
|
LoginInfo,
|
||||||
@ -52,6 +53,7 @@ import {
|
|||||||
ServiceProtocolService,
|
ServiceProtocolService,
|
||||||
UserPasswordSetResponse
|
UserPasswordSetResponse
|
||||||
} from '@ucap-webmessenger/protocol-service';
|
} from '@ucap-webmessenger/protocol-service';
|
||||||
|
import { AuthenticationProtocolService } from '@ucap-webmessenger/protocol-authentication';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Effects {
|
export class Effects {
|
||||||
@ -122,21 +124,33 @@ export class Effects {
|
|||||||
this.actions$.pipe(
|
this.actions$.pipe(
|
||||||
ofType(loginRedirect),
|
ofType(loginRedirect),
|
||||||
tap(authed => {
|
tap(authed => {
|
||||||
this.router.navigate(['/account/login']);
|
this.ngZone.run(() => {
|
||||||
|
this.router.navigate(['/account/login']).then(() => {
|
||||||
|
this.store.dispatch(logoutInitialize());
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
{ dispatch: false }
|
{ dispatch: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
logout$ = createEffect(() =>
|
logout$ = createEffect(
|
||||||
this.actions$.pipe(
|
() => {
|
||||||
ofType(logout),
|
return this.actions$.pipe(
|
||||||
map(action => action),
|
ofType(logout),
|
||||||
map(() => {
|
switchMap(action => {
|
||||||
this.appAuthenticationService.logout();
|
return this.authenticationProtocolService.logout({}).pipe(
|
||||||
return loginRedirect();
|
map(res => {
|
||||||
})
|
this.appAuthenticationService.logout();
|
||||||
)
|
this.store.dispatch(loginRedirect());
|
||||||
|
}),
|
||||||
|
catchError(error => of(error))
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
{ dispatch: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
logoutConfirmation$ = createEffect(() =>
|
logoutConfirmation$ = createEffect(() =>
|
||||||
@ -288,11 +302,13 @@ export class Effects {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
|
private ngZone: NgZone,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private store: Store<any>,
|
private store: Store<any>,
|
||||||
private sessionStorageService: SessionStorageService,
|
private sessionStorageService: SessionStorageService,
|
||||||
private piService: PiService,
|
private piService: PiService,
|
||||||
private appAuthenticationService: AppAuthenticationService,
|
private appAuthenticationService: AppAuthenticationService,
|
||||||
|
private authenticationProtocolService: AuthenticationProtocolService,
|
||||||
private serviceProtocolService: ServiceProtocolService,
|
private serviceProtocolService: ServiceProtocolService,
|
||||||
private dialogService: DialogService,
|
private dialogService: DialogService,
|
||||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||||
|
@ -3,7 +3,9 @@ import { State, initialState } from './state';
|
|||||||
import {
|
import {
|
||||||
loginSuccess,
|
loginSuccess,
|
||||||
increaseLoginFailCount,
|
increaseLoginFailCount,
|
||||||
initialLoginFailCount
|
initialLoginFailCount,
|
||||||
|
logout,
|
||||||
|
logoutInitialize
|
||||||
} from './actions';
|
} from './actions';
|
||||||
|
|
||||||
export const reducer = createReducer(
|
export const reducer = createReducer(
|
||||||
@ -21,10 +23,17 @@ export const reducer = createReducer(
|
|||||||
loginFailCount: state.loginFailCount + 1
|
loginFailCount: state.loginFailCount + 1
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
on(initialLoginFailCount, (state, action) => {
|
on(initialLoginFailCount, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
loginFailCount: 0
|
loginFailCount: 0
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(logoutInitialize, (state, action) => {
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,8 @@ import {
|
|||||||
clearRightDrawer
|
clearRightDrawer
|
||||||
} from './actions';
|
} from './actions';
|
||||||
|
|
||||||
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
|
||||||
export const reducer = createReducer(
|
export const reducer = createReducer(
|
||||||
initialState,
|
initialState,
|
||||||
on(selectedRoom, (state, action) => {
|
on(selectedRoom, (state, action) => {
|
||||||
@ -64,5 +66,11 @@ export const reducer = createReducer(
|
|||||||
...state,
|
...state,
|
||||||
selectedRightDrawer: null
|
selectedRightDrawer: null
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -128,12 +128,13 @@ export const reducer = createReducer(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
on(AuthenticationStore.logout, (state, action) => {
|
on(ChatStore.clearSelectedRoom, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
on(ChatStore.clearSelectedRoom, (state, action) => {
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ export const reducer = createReducer(
|
|||||||
reg: action.res
|
reg: action.res
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
on(AuthenticationStore.logout, (state, action) => {
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ export const reducer = createReducer(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
on(AuthenticationStore.logout, (state, action) => {
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
|
@ -64,12 +64,13 @@ export const reducer = createReducer(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
on(AuthenticationStore.logout, (state, action) => {
|
on(ChatStore.clearSelectedRoom, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
on(ChatStore.clearSelectedRoom, (state, action) => {
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
|
@ -42,7 +42,7 @@ export const reducer = createReducer(
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
||||||
on(AuthenticationStore.logout, (state, action) => {
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
return {
|
return {
|
||||||
...initialState
|
...initialState
|
||||||
};
|
};
|
||||||
|
@ -30,6 +30,8 @@ import * as RoomStore from '@app/store/messenger/room';
|
|||||||
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
|
||||||
import { StringUtil } from '@ucap-webmessenger/ui';
|
import { StringUtil } from '@ucap-webmessenger/ui';
|
||||||
|
|
||||||
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
|
||||||
export const reducer = createReducer(
|
export const reducer = createReducer(
|
||||||
initialState,
|
initialState,
|
||||||
on(buddy2Success, (state, action) => {
|
on(buddy2Success, (state, action) => {
|
||||||
@ -283,5 +285,11 @@ export const reducer = createReducer(
|
|||||||
...state,
|
...state,
|
||||||
buddy2: adapterBuddy2.upsertOne(userInfo, { ...state.buddy2 })
|
buddy2: adapterBuddy2.upsertOne(userInfo, { ...state.buddy2 })
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import { createReducer, on } from '@ngrx/store';
|
import { createReducer, on } from '@ngrx/store';
|
||||||
|
|
||||||
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
|
||||||
import { initialState } from './state';
|
import { initialState } from './state';
|
||||||
import { companyListSuccess } from './actions';
|
import { companyListSuccess } from './actions';
|
||||||
|
|
||||||
@ -9,5 +12,11 @@ export const reducer = createReducer(
|
|||||||
...state,
|
...state,
|
||||||
companyList: action.companyList
|
companyList: action.companyList
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -2,6 +2,8 @@ import { createReducer, on } from '@ngrx/store';
|
|||||||
import { initialState } from './state';
|
import { initialState } from './state';
|
||||||
import { versionInfo2Success } from './actions';
|
import { versionInfo2Success } from './actions';
|
||||||
|
|
||||||
|
import * as AuthenticationStore from '@app/store/account/authentication';
|
||||||
|
|
||||||
export const reducer = createReducer(
|
export const reducer = createReducer(
|
||||||
initialState,
|
initialState,
|
||||||
on(versionInfo2Success, (state, action) => {
|
on(versionInfo2Success, (state, action) => {
|
||||||
@ -19,5 +21,11 @@ export const reducer = createReducer(
|
|||||||
fileDownloadUrl: action.res.downloadUrl,
|
fileDownloadUrl: action.res.downloadUrl,
|
||||||
serverIp: action.res.serverIp
|
serverIp: action.res.serverIp
|
||||||
};
|
};
|
||||||
|
}),
|
||||||
|
|
||||||
|
on(AuthenticationStore.logoutInitialize, (state, action) => {
|
||||||
|
return {
|
||||||
|
...initialState
|
||||||
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user