Restructure project (#124)
This commit is contained in:
30
front/src/services/api/users/index.tsx
Normal file
30
front/src/services/api/users/index.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { QueryResult, gql, useQuery } from '@apollo/client';
|
||||
import { GraphqlQueryUser } from '../../../interfaces/entities/user.interface';
|
||||
|
||||
export const GET_CURRENT_USER = gql`
|
||||
query GetCurrentUser($uuid: uuid) {
|
||||
users(where: { id: { _eq: $uuid } }) {
|
||||
id
|
||||
email
|
||||
displayName
|
||||
workspace_member {
|
||||
workspace {
|
||||
id
|
||||
domain_name
|
||||
display_name
|
||||
logo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function useGetCurrentUserQuery(userId: string | null): QueryResult<{
|
||||
users: GraphqlQueryUser[];
|
||||
}> {
|
||||
return useQuery<{ users: GraphqlQueryUser[] }>(GET_CURRENT_USER, {
|
||||
variables: {
|
||||
uuid: userId,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user