Untitled
unknown
plain_text
2 years ago
1.2 kB
5
Indexable
/* Licensed Materials - Property of IBM 694906H (c) Copyright IBM Corp. 2020 All Rights Reserved US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ import { useQuery, gql, useLazyQuery } from '@apollo/client'; import { handleApolloError } from '@exo/frontend-common-apollo'; interface ITagueamento { ids: string[]; } const GET_TAGUEAMENTO = gql` query GetTagueamento($ids: [String!]) { getTagueamento(ids: $ids) { id name brand category affiliation price quantity currency } } `; export const useTagueamento = ({ ids }: ITagueamento) => { const { called, loading, data, error } = useQuery(GET_TAGUEAMENTO, { variables: { ids } }); handleApolloError(__filename, error); return { called, loading, data, error }; }; export const useLazyTagueamento = () => { const [getTagueamento, { called, loading, data, error }] = useLazyQuery<any, { ids: string[] }>( GET_TAGUEAMENTO, { fetchPolicy: 'no-cache' } ); handleApolloError(__filename, error); return { getTagueamento, called, loading, data, error }; };
Editor is loading...