snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
51
react/features/feedback/reducer.ts
Normal file
51
react/features/feedback/reducer.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
||||
|
||||
import {
|
||||
CANCEL_FEEDBACK,
|
||||
SUBMIT_FEEDBACK_ERROR,
|
||||
SUBMIT_FEEDBACK_SUCCESS
|
||||
} from './actionTypes';
|
||||
|
||||
const DEFAULT_STATE = {
|
||||
message: '',
|
||||
|
||||
// The sentinel value -1 is used to denote no rating has been set and to
|
||||
// preserve pre-redux behavior.
|
||||
score: -1,
|
||||
submitted: false
|
||||
};
|
||||
|
||||
export interface IFeedbackState {
|
||||
message: string;
|
||||
score: number;
|
||||
submitted: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the Redux actions of the feature features/feedback.
|
||||
*/
|
||||
ReducerRegistry.register<IFeedbackState>(
|
||||
'features/feedback',
|
||||
(state = DEFAULT_STATE, action): IFeedbackState => {
|
||||
switch (action.type) {
|
||||
case CANCEL_FEEDBACK: {
|
||||
return {
|
||||
...state,
|
||||
message: action.message,
|
||||
score: action.score
|
||||
};
|
||||
}
|
||||
|
||||
case SUBMIT_FEEDBACK_ERROR:
|
||||
case SUBMIT_FEEDBACK_SUCCESS: {
|
||||
return {
|
||||
...state,
|
||||
message: '',
|
||||
score: -1,
|
||||
submitted: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
});
|
||||
Reference in New Issue
Block a user