Download spectrum/shared/graphql/mutations/user/editUser.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/graphql/mutations/user/editUser.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/shared/graphql/mutations/user/editUser.js
-
curl -L -o editUser.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/graphql/mutations/user/editUser.js
1.15 kB
| // @flow | |
| import { graphql } from 'react-apollo'; | |
| import gql from 'graphql-tag'; | |
| import userInfoFragment from '../../fragments/user/userInfo'; | |
| import type { UserInfoType } from '../../fragments/user/userInfo'; | |
| import type { EditUserInput } from 'shared/db/queries/user'; | |
| import { getUserByUsernameQuery } from '../../queries/user/getUser'; | |
| export type EditUserType = { | |
| ...$Exact<UserInfoType>, | |
| }; | |
| export type EditUserProps = { | |
| editUser: ( | |
| input: $PropertyType<EditUserInput, 'input'> | |
| ) => Promise<EditUserType>, | |
| }; | |
| export const editUserMutation = gql` | |
| mutation editUser($input: EditUserInput!) { | |
| editUser(input: $input) { | |
| ...userInfo | |
| } | |
| } | |
| ${userInfoFragment} | |
| `; | |
| const editUserOptions = { | |
| options: { | |
| refetchQueries: ['getCurrentUser'], | |
| }, | |
| props: ({ mutate }) => ({ | |
| editUser: input => | |
| mutate({ | |
| variables: { | |
| input, | |
| }, | |
| refetchQueries: [ | |
| { | |
| query: getUserByUsernameQuery, | |
| variables: { | |
| id: input.username, | |
| }, | |
| }, | |
| ], | |
| }), | |
| }), | |
| }; | |
| export default graphql(editUserMutation, editUserOptions); | |