2023-02-28 09:46:31 +03:00

34 lines
790 B
TypeScript

import type { GetQuoteInputData, GetQuoteProcessData } from '../load-kp/types';
import initializeApollo from '@/apollo/client';
import * as CRMTypes from '@/graphql/crm.types';
import { gql } from '@apollo/client';
const QUERY_GET_QUOTE_CONFIGURATOR_DATA = gql`
query GetQuoteConfiguratorData($quoteId: Uuid!) {
quote(quoteId: $quoteId) {
evo_baseproductid
}
}
`;
export async function getKPData({
values: { quote: quoteId },
}: GetQuoteInputData): Promise<GetQuoteProcessData> {
const apolloClient = initializeApollo();
const {
data: { quote },
} = await apolloClient.query({
query: CRMTypes.GetQuoteConfiguratorDataDocument,
variables: {
quoteId,
},
});
return {
values: {
product: quote?.evo_baseproductid,
},
};
}