import React, { useEffect } from 'react'; import { Page } from '../Page'; import { UserForm } from '../UserForm'; import { Loader } from '../Loader'; import { User } from '../../types/user'; import { useUserProfileQuery } from '../../gql/queries/profile'; import { useUpdateUserProfileMutation } from '../../gql/mutations/profile'; import { WithLoader } from '../WithLoader'; export function ProfilePage() { const userProfileQuery = useUserProfileQuery(); const [ updatProfile, updateUserProfileMutation ] = useUpdateUserProfileMutation(); const isLoading = updateUserProfileMutation.loading || userProfileQuery.loading; const { userProfile } = (userProfileQuery.data || {}); const onUserChange = (user: User) => { if (userProfile.name !== user.name) { updatProfile({ variables: {changes: { name: user.name }}}); } }; return (

Mon profil

{ userProfile ? : }
); }