86016: Add typedocs

This commit is contained in:
Yura Bondarenko
2021-12-23 16:42:14 +01:00
parent a2515c11e1
commit c1e8bbbeae
2 changed files with 12 additions and 0 deletions

View File

@@ -5,6 +5,9 @@ export const CorrelationIDActionTypes = {
SET: type('dspace/core/correlationId/SET') SET: type('dspace/core/correlationId/SET')
}; };
/**
* Action for setting a new correlation ID
*/
export class SetCorrelationIdAction implements Action { export class SetCorrelationIdAction implements Action {
type = CorrelationIDActionTypes.SET; type = CorrelationIDActionTypes.SET;
@@ -12,4 +15,7 @@ export class SetCorrelationIdAction implements Action {
} }
} }
/**
* Type alias for all correlation ID actions
*/
export type CorrelationIdAction = SetCorrelationIdAction; export type CorrelationIdAction = SetCorrelationIdAction;

View File

@@ -9,6 +9,12 @@ const initialState = null;
export const correlationIdSelector = (state: AppState) => state.correlationId; export const correlationIdSelector = (state: AppState) => state.correlationId;
/**
* Reducer that handles actions to update the correlation ID
* @param {string} state the previous correlation ID (null if unset)
* @param {CorrelationIdAction} action the action to perform
* @return {string} the new correlation ID
*/
export const correlationIdReducer = (state = initialState, action: CorrelationIdAction): string => { export const correlationIdReducer = (state = initialState, action: CorrelationIdAction): string => {
switch (action.type) { switch (action.type) {
case CorrelationIDActionTypes.SET: { case CorrelationIDActionTypes.SET: {