Download wp-calypso/client/dashboard/data/me-profile.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/me-profile.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/dashboard/data/me-profile.ts
-
curl -L -o me-profile.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/data/me-profile.ts
672 Bytes
| import wpcom from 'calypso/lib/wp'; | |
| export interface UserProfile { | |
| user_login: string; | |
| display_name: string; | |
| user_email: string; | |
| user_URL: string; | |
| description: string; | |
| is_dev_account: boolean; | |
| avatar_URL: string; | |
| } | |
| export async function fetchProfile(): Promise< UserProfile > { | |
| return await wpcom.req.get( '/me/settings' ); | |
| } | |
| export async function updateProfile( data: Partial< UserProfile > ) { | |
| const saveableKeys = [ 'display_name', 'description', 'is_dev_account', 'user_URL' ]; | |
| for ( const key in data ) { | |
| if ( ! saveableKeys.includes( key ) ) { | |
| delete data[ key as keyof UserProfile ]; | |
| } | |
| } | |
| return await wpcom.req.post( '/me/settings', data ); | |
| } | |