Move supportform related redux property in a different reducer
Summary: This diff moves support form related redux prop to a separate reducer under separate supportForm property. Reviewed By: passy Differential Revision: D18272436 fbshipit-source-id: b64c4e041d8dacd305a71db255752a310a46b0d1
This commit is contained in:
committed by
Facebook Github Bot
parent
9ec4ef67ad
commit
7c69aba8fa
46
src/reducers/supportForm.tsx
Normal file
46
src/reducers/supportForm.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {Actions} from './';
|
||||
export type State = {
|
||||
webState: NTUsersFormData | null;
|
||||
};
|
||||
export type Action = {
|
||||
type: 'SET_SUPPORT_FORM_STATE';
|
||||
payload: NTUsersFormData | null;
|
||||
};
|
||||
|
||||
export type NTUsersFormData = {
|
||||
flipper_trace: string | null;
|
||||
};
|
||||
|
||||
export const initialState: () => State = () => ({
|
||||
webState: null,
|
||||
});
|
||||
export default function reducer(
|
||||
state: State | undefined,
|
||||
action: Actions,
|
||||
): State {
|
||||
state = state || initialState();
|
||||
if (action.type === 'SET_SUPPORT_FORM_STATE') {
|
||||
return {
|
||||
...state,
|
||||
webState: action.payload,
|
||||
};
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export const setSupportFormState = (
|
||||
payload: NTUsersFormData | null,
|
||||
): Action => ({
|
||||
type: 'SET_SUPPORT_FORM_STATE',
|
||||
payload,
|
||||
});
|
||||
Reference in New Issue
Block a user