44// SPDX-License-Identifier: AGPL-3.0-only
55// Please see LICENSE in the repository root for full details.
66
7+ import { useMutation , useQueryClient } from "@tanstack/react-query" ;
78import IconDelete from "@vector-im/compound-design-tokens/assets/web/icons/delete" ;
89import IconEmail from "@vector-im/compound-design-tokens/assets/web/icons/email" ;
910import { Button , Form , IconButton , Tooltip } from "@vector-im/compound-web" ;
1011import type { ComponentProps , ReactNode } from "react" ;
1112import { Translation , useTranslation } from "react-i18next" ;
1213import { type FragmentType , graphql , useFragment } from "../../gql" ;
14+ import { graphqlRequest } from "../../graphql" ;
1315import { Close , Description , Dialog , Title } from "../Dialog" ;
1416import { Link } from "../Link" ;
15-
16- import { useMutation , useQueryClient } from "@tanstack/react-query" ;
17- import { graphqlClient } from "../../graphql" ;
1817import styles from "./UserEmail.module.css" ;
1918
2019// This component shows a single user email address, with controls to verify it,
@@ -136,7 +135,7 @@ const UserEmail: React.FC<{
136135
137136 const setPrimary = useMutation ( {
138137 mutationFn : ( id : string ) =>
139- graphqlClient . request ( SET_PRIMARY_EMAIL_MUTATION , { id } ) ,
138+ graphqlRequest ( { query : SET_PRIMARY_EMAIL_MUTATION , variables : { id } } ) ,
140139 onSuccess : ( _data ) => {
141140 queryClient . invalidateQueries ( { queryKey : [ "currentUserGreeting" ] } ) ;
142141 queryClient . invalidateQueries ( { queryKey : [ "userEmails" ] } ) ;
@@ -145,7 +144,7 @@ const UserEmail: React.FC<{
145144
146145 const removeEmail = useMutation ( {
147146 mutationFn : ( id : string ) =>
148- graphqlClient . request ( REMOVE_EMAIL_MUTATION , { id } ) ,
147+ graphqlRequest ( { query : REMOVE_EMAIL_MUTATION , variables : { id } } ) ,
149148 onSuccess : ( _data ) => {
150149 onRemove ?.( ) ;
151150 queryClient . invalidateQueries ( { queryKey : [ "currentUserGreeting" ] } ) ;
0 commit comments