vchikalkin 95bd5d1010 Revert "repo: move ./graphql to packages/graphql (gql)"
This reverts commit 74af4fb4922cf84f297807b25c19a1ae9f40a9b5.
2022-12-20 19:48:13 +03:00

33 lines
865 B
TypeScript

import { gql, useQuery } from '@apollo/client';
import type * as CRMTypes from 'graphql/crm.types';
import { observer } from 'mobx-react-lite';
import { useStore } from 'stores/hooks';
const QUERY_GET_CURRENCY_SYMBOL = gql`
query GetCurrencySymbol($currencyid: Uuid!) {
transactioncurrency(transactioncurrencyid: $currencyid) {
currencysymbol
}
}
`;
const CurrencyAddon = observer(() => {
const { $calculation } = useStore();
const currencyid = $calculation.element('selectSupplierCurrency').getValue();
const { data } = useQuery<
CRMTypes.GetCurrencySymbolQuery,
CRMTypes.GetCurrencySymbolQueryVariables
>(QUERY_GET_CURRENCY_SYMBOL, {
variables: {
currencyid: currencyid!,
},
skip: !currencyid,
});
return <span>{data?.transactioncurrency?.currencysymbol}</span>;
});
export default <CurrencyAddon />;