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:
Pritesh Nandgaonkar
2019-11-04 03:57:23 -08:00
committed by Facebook Github Bot
parent 9ec4ef67ad
commit 7c69aba8fa
3 changed files with 53 additions and 21 deletions

View 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,
});