88} from '../features/licenseDetailsSlice'
99import { getClient } from 'Redux/api/base'
1010import LicenseDetailsApi from '../api/LicenseDetailsApi'
11- import { initAudit } from 'Redux/sagas/SagaUtils'
11+ import { initAudit , redirectToLogout } from 'Redux/sagas/SagaUtils'
1212import { postUserAction } from 'Redux/api/backend-api'
13- import { addAdditionalData , isFourZeroOneError } from 'Utils/TokenController'
13+ import { addAdditionalData , isFourZeroThreeError } from 'Utils/TokenController'
1414import { API_LICENSE } from '../../audit/Resources'
1515import { DELETION } from '@/audit/UserActionType'
1616const JansConfigApi = require ( 'jans_config_api' )
@@ -42,9 +42,10 @@ export function* resetLicenseConfigWorker(action: ResetLicenseAction) {
4242 yield put ( setLicenseResetFailure ( ) )
4343 }
4444 } catch ( error ) {
45- if ( isFourZeroOneError ( error ) ) {
45+ if ( isFourZeroThreeError ( error ) ) {
4646 // Session expired - redirect to login
47- window . location . href = '/logout'
47+ yield * redirectToLogout ( )
48+ return
4849 }
4950 }
5051}
@@ -60,9 +61,10 @@ export function* getLicenseDetailsWorker() {
6061 } catch ( e ) {
6162 console . log ( 'error in getting license details: ' , e )
6263 yield put ( getLicenseDetailsResponse ( null ) )
63- if ( isFourZeroOneError ( e ) ) {
64+ if ( isFourZeroThreeError ( e ) ) {
6465 // Session expired - redirect to login
65- window . location . href = '/logout'
66+ yield * redirectToLogout ( )
67+ return
6668 }
6769 }
6870}
@@ -77,9 +79,10 @@ export function* updateLicenseDetailsWorker({ payload }) {
7779 yield call ( postUserAction , audit )
7880 } catch ( e ) {
7981 yield put ( updateLicenseDetailsResponse ( null ) )
80- if ( isFourZeroOneError ( e ) ) {
82+ if ( isFourZeroThreeError ( e ) ) {
8183 // Session expired - redirect to login
82- window . location . href = '/logout'
84+ yield * redirectToLogout ( )
85+ return
8386 }
8487 }
8588}
0 commit comments