Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33044906
D7269.1768417971.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7269.1768417971.diff
View Options
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js
--- a/lib/reducers/master-reducer.js
+++ b/lib/reducers/master-reducer.js
@@ -15,6 +15,7 @@
import { reduceNotifPermissionAlertInfo } from './notif-permission-alert-info-reducer.js';
import policiesReducer from './policies-reducer.js';
import reduceReportStore from './report-store-reducer.js';
+import reduceServicesAccessToken from './services-access-token-reducer.js';
import { reduceThreadInfos } from './thread-reducer.js';
import reduceUpdatesCurrentAsOf from './updates-reducer.js';
import reduceURLPrefix from './url-prefix-reducer.js';
@@ -114,6 +115,10 @@
dataLoaded: reduceDataLoaded(state.dataLoaded, action),
userPolicies: policiesReducer(state.userPolicies, action),
deviceToken: reduceDeviceToken(state.deviceToken, action),
+ commServicesAccessToken: reduceServicesAccessToken(
+ state.commServicesAccessToken,
+ action,
+ ),
},
storeOperations: {
draftStoreOperations,
diff --git a/lib/reducers/services-access-token-reducer.js b/lib/reducers/services-access-token-reducer.js
new file mode 100644
--- /dev/null
+++ b/lib/reducers/services-access-token-reducer.js
@@ -0,0 +1,37 @@
+// @flow
+
+import { siweAuthActionTypes } from '../actions/siwe-actions.js';
+import {
+ logOutActionTypes,
+ deleteAccountActionTypes,
+ logInActionTypes,
+ registerActionTypes,
+} from '../actions/user-actions.js';
+import type { BaseAction } from '../types/redux-types.js';
+import { setNewSessionActionType } from '../utils/action-utils.js';
+
+export default function reduceServicesAccessToken(
+ state: ?string,
+ action: BaseAction,
+): ?string {
+ if (
+ action.type === logInActionTypes.success ||
+ action.type === siweAuthActionTypes.success ||
+ action.type === registerActionTypes.success
+ ) {
+ return null;
+ } else if (
+ action.type === setNewSessionActionType &&
+ action.payload.sessionChange.currentUserInfo &&
+ action.payload.sessionChange.currentUserInfo.anonymous
+ ) {
+ return null;
+ } else if (
+ action.type === logOutActionTypes.started ||
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success
+ ) {
+ return null;
+ }
+ return state;
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 7:12 PM (10 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5933526
Default Alt Text
D7269.1768417971.diff (2 KB)
Attached To
Mode
D7269: [lib] Reducer for commServicesAccessToken
Attached
Detach File
Event Timeline
Log In to Comment