@frontegg/redux-store 6.186.0-alpha.0 → 6.186.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/ImpersonationState/saga.js +8 -0
- package/auth/LoginState/sagas/afterAuthNavigation.saga.js +5 -0
- package/auth/SessionsState/saga.js +5 -1
- package/index.js +1 -1
- package/node/auth/ImpersonationState/saga.js +8 -0
- package/node/auth/LoginState/sagas/afterAuthNavigation.saga.js +5 -0
- package/node/auth/SessionsState/saga.js +5 -1
- package/node/index.js +1 -1
- package/package.json +1 -1
|
@@ -16,16 +16,24 @@ function* impersonate(_ref) {
|
|
|
16
16
|
yield put(actions.setImpersonateState({
|
|
17
17
|
loading: true
|
|
18
18
|
}));
|
|
19
|
+
console.log('going to impersonate', payload);
|
|
19
20
|
try {
|
|
20
21
|
const data = yield call(api.impersonate.impersonate, payload);
|
|
22
|
+
console.log('after request', data);
|
|
21
23
|
yield put(actions.setImpersonateState({
|
|
22
24
|
step: ImpersonateStep.success
|
|
23
25
|
}));
|
|
26
|
+
console.log('after setImpersonateState');
|
|
24
27
|
yield delay(1000);
|
|
28
|
+
console.log('after delay');
|
|
25
29
|
yield afterAuthNavigation();
|
|
30
|
+
console.log('after afterAuthNavigation');
|
|
26
31
|
yield put(actions.resetImpersonateState());
|
|
32
|
+
console.log('after resetImpersonateState');
|
|
27
33
|
callback == null ? void 0 : callback(true);
|
|
34
|
+
console.log('after callback');
|
|
28
35
|
} catch (e) {
|
|
36
|
+
console.log('throws with error', e);
|
|
29
37
|
yield put(actions.setImpersonateState({
|
|
30
38
|
loading: false,
|
|
31
39
|
error: errorHandler(e)
|
|
@@ -86,8 +86,12 @@ export function* afterAuthNavigationUtil(resetStateAction, {
|
|
|
86
86
|
}
|
|
87
87
|
(_window3 = window) == null ? void 0 : _window3.localStorage.removeItem(FRONTEGG_AFTER_AUTH_REDIRECT_URL);
|
|
88
88
|
}
|
|
89
|
+
console.log('afterAuthNavigationUtil redirectUrl', redirectUrl);
|
|
89
90
|
yield delay(200);
|
|
90
91
|
put(resetStateAction());
|
|
92
|
+
console.log('afterAuthNavigationUtil onRedirectTo', {
|
|
93
|
+
refresh: redirectUrl.startsWith('http')
|
|
94
|
+
});
|
|
91
95
|
onRedirectTo(redirectUrl, {
|
|
92
96
|
refresh: redirectUrl.startsWith('http')
|
|
93
97
|
});
|
|
@@ -129,6 +133,7 @@ export function* afterAuthNavigation() {
|
|
|
129
133
|
return (_state$auth$routes = state.auth.routes) == null ? void 0 : _state$auth$routes.customLoginAuthenticatedUrl;
|
|
130
134
|
});
|
|
131
135
|
}
|
|
136
|
+
console.log('call afterAuthNavigationUtil');
|
|
132
137
|
yield call(afterAuthNavigationUtil, actions.resetLoginState, {
|
|
133
138
|
customLoginAuthenticatedUrl: customLoginURL,
|
|
134
139
|
shouldStepUpDuringLogin: !!shouldStepUp
|
|
@@ -2,6 +2,7 @@ import { takeLatest, put, call, select, takeEvery } from 'redux-saga/effects';
|
|
|
2
2
|
import { api } from '@frontegg/rest-api';
|
|
3
3
|
import { actions } from '../reducer';
|
|
4
4
|
import { sessionsMock } from '../dummy';
|
|
5
|
+
import { errorHandler } from '../../utils';
|
|
5
6
|
function* loadCurrentUserSessions() {
|
|
6
7
|
yield put(actions.setSessionsState({
|
|
7
8
|
loading: true,
|
|
@@ -69,10 +70,13 @@ function* revokeUserSessions({
|
|
|
69
70
|
}));
|
|
70
71
|
try {
|
|
71
72
|
yield call(api.auth.revokeSessionsForUser, userId);
|
|
73
|
+
yield put(actions.setSessionsState({
|
|
74
|
+
loading: false
|
|
75
|
+
}));
|
|
72
76
|
callback == null ? void 0 : callback(true);
|
|
73
77
|
} catch (e) {
|
|
74
78
|
yield put(actions.setSessionsState({
|
|
75
|
-
error: e,
|
|
79
|
+
error: errorHandler(e),
|
|
76
80
|
loading: false
|
|
77
81
|
}));
|
|
78
82
|
callback == null ? void 0 : callback(false);
|
package/index.js
CHANGED
|
@@ -23,16 +23,24 @@ function* impersonate(_ref) {
|
|
|
23
23
|
yield (0, _effects.put)(_reducer.actions.setImpersonateState({
|
|
24
24
|
loading: true
|
|
25
25
|
}));
|
|
26
|
+
console.log('going to impersonate', payload);
|
|
26
27
|
try {
|
|
27
28
|
const data = yield (0, _effects.call)(_restApi.api.impersonate.impersonate, payload);
|
|
29
|
+
console.log('after request', data);
|
|
28
30
|
yield (0, _effects.put)(_reducer.actions.setImpersonateState({
|
|
29
31
|
step: _interfaces.ImpersonateStep.success
|
|
30
32
|
}));
|
|
33
|
+
console.log('after setImpersonateState');
|
|
31
34
|
yield (0, _effects.delay)(1000);
|
|
35
|
+
console.log('after delay');
|
|
32
36
|
yield (0, _saga.afterAuthNavigation)();
|
|
37
|
+
console.log('after afterAuthNavigation');
|
|
33
38
|
yield (0, _effects.put)(_reducer.actions.resetImpersonateState());
|
|
39
|
+
console.log('after resetImpersonateState');
|
|
34
40
|
callback == null ? void 0 : callback(true);
|
|
41
|
+
console.log('after callback');
|
|
35
42
|
} catch (e) {
|
|
43
|
+
console.log('throws with error', e);
|
|
36
44
|
yield (0, _effects.put)(_reducer.actions.setImpersonateState({
|
|
37
45
|
loading: false,
|
|
38
46
|
error: (0, _utils.errorHandler)(e)
|
|
@@ -93,8 +93,12 @@ function* afterAuthNavigationUtil(resetStateAction, {
|
|
|
93
93
|
}
|
|
94
94
|
(_window3 = window) == null ? void 0 : _window3.localStorage.removeItem(_constants.FRONTEGG_AFTER_AUTH_REDIRECT_URL);
|
|
95
95
|
}
|
|
96
|
+
console.log('afterAuthNavigationUtil redirectUrl', redirectUrl);
|
|
96
97
|
yield (0, _effects.delay)(200);
|
|
97
98
|
(0, _effects.put)(resetStateAction());
|
|
99
|
+
console.log('afterAuthNavigationUtil onRedirectTo', {
|
|
100
|
+
refresh: redirectUrl.startsWith('http')
|
|
101
|
+
});
|
|
98
102
|
onRedirectTo(redirectUrl, {
|
|
99
103
|
refresh: redirectUrl.startsWith('http')
|
|
100
104
|
});
|
|
@@ -136,6 +140,7 @@ function* afterAuthNavigation() {
|
|
|
136
140
|
return (_state$auth$routes = state.auth.routes) == null ? void 0 : _state$auth$routes.customLoginAuthenticatedUrl;
|
|
137
141
|
});
|
|
138
142
|
}
|
|
143
|
+
console.log('call afterAuthNavigationUtil');
|
|
139
144
|
yield (0, _effects.call)(afterAuthNavigationUtil, _reducer.actions.resetLoginState, {
|
|
140
145
|
customLoginAuthenticatedUrl: customLoginURL,
|
|
141
146
|
shouldStepUpDuringLogin: !!shouldStepUp
|
|
@@ -9,6 +9,7 @@ var _effects = require("redux-saga/effects");
|
|
|
9
9
|
var _restApi = require("@frontegg/rest-api");
|
|
10
10
|
var _reducer = require("../reducer");
|
|
11
11
|
var _dummy = require("../dummy");
|
|
12
|
+
var _utils = require("../../utils");
|
|
12
13
|
function* loadCurrentUserSessions() {
|
|
13
14
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
14
15
|
loading: true,
|
|
@@ -76,10 +77,13 @@ function* revokeUserSessions({
|
|
|
76
77
|
}));
|
|
77
78
|
try {
|
|
78
79
|
yield (0, _effects.call)(_restApi.api.auth.revokeSessionsForUser, userId);
|
|
80
|
+
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
81
|
+
loading: false
|
|
82
|
+
}));
|
|
79
83
|
callback == null ? void 0 : callback(true);
|
|
80
84
|
} catch (e) {
|
|
81
85
|
yield (0, _effects.put)(_reducer.actions.setSessionsState({
|
|
82
|
-
error: e,
|
|
86
|
+
error: (0, _utils.errorHandler)(e),
|
|
83
87
|
loading: false
|
|
84
88
|
}));
|
|
85
89
|
callback == null ? void 0 : callback(false);
|
package/node/index.js
CHANGED