Download wp-calypso/packages/data-stores/src/user/reducer.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 566 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/user/reducer.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/packages/data-stores/src/user/reducer.ts
-
curl -L -o reducer.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/packages/data-stores/src/user/reducer.ts
566 Bytes
| import { combineReducers } from '@wordpress/data'; | |
| import type { Action } from './actions'; | |
| import type { CurrentUser } from './types'; | |
| import type { Reducer } from 'redux'; | |
| export const currentUser: Reducer< CurrentUser | null | undefined, Action > = ( state, action ) => { | |
| switch ( action.type ) { | |
| case 'RECEIVE_CURRENT_USER': | |
| return action.currentUser; | |
| case 'RECEIVE_CURRENT_USER_FAILED': | |
| return null; | |
| } | |
| return state; | |
| }; | |
| const reducer = combineReducers( { currentUser } ); | |
| export type State = ReturnType< typeof reducer >; | |
| export default reducer; | |