Download wp-calypso/client/data/block-editor/use-block-editor-nux-status-query.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 773 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/block-editor/use-block-editor-nux-status-query.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/data/block-editor/use-block-editor-nux-status-query.ts
-
curl -L -o use-block-editor-nux-status-query.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/data/block-editor/use-block-editor-nux-status-query.ts
773 Bytes
| import { useQuery, UseQueryResult } from '@tanstack/react-query'; | |
| import wpcom from 'calypso/lib/wp'; | |
| import { useSelector } from 'calypso/state'; | |
| import { isJetpackSite } from 'calypso/state/sites/selectors'; | |
| export type BlockEditorNuxStatus = { | |
| show_welcome_guide: boolean; | |
| }; | |
| export const useBlockEditorNuxStatusQuery = ( | |
| siteId: number | |
| ): UseQueryResult< BlockEditorNuxStatus > => { | |
| const queryKey = [ 'blockEditorNuxStatus', siteId ]; | |
| const siteIsJetpack = useSelector( ( state ) => isJetpackSite( state, siteId ) ); | |
| return useQuery< BlockEditorNuxStatus >( { | |
| queryKey, | |
| queryFn: () => { | |
| return wpcom.req.get( { | |
| path: `/sites/${ siteId }/block-editor/nux`, | |
| apiNamespace: 'wpcom/v2', | |
| } ); | |
| }, | |
| enabled: !! siteId && ! siteIsJetpack, | |
| } ); | |
| }; | |