actions(createKP): set pdf url after createKP
This commit is contained in:
parent
df1c732521
commit
60adb72e26
@ -2,6 +2,7 @@ import { message } from 'antd';
|
||||
import { AxiosError } from 'axios';
|
||||
import { openNotification } from 'client/Elements/Notification';
|
||||
import UserStore from 'client/stores/UserStore';
|
||||
import { CRM_PROXY_URL } from 'core/constants/urls';
|
||||
import { getQuotesByLeadQuery } from 'core/graphql/query/crm/quote';
|
||||
import CrmService from 'core/services/CrmService';
|
||||
import { ICalculationStore } from 'core/types/Calculation/Store';
|
||||
@ -56,12 +57,17 @@ export default async function (this: ICalculationStore) {
|
||||
const payload = await composeRequest.call(this);
|
||||
if (!payload) return;
|
||||
|
||||
await CrmService.createKP(payload);
|
||||
const { data: newKP } = await CrmService.createKP(payload);
|
||||
message.success({
|
||||
content: 'КП создано!',
|
||||
content: 'КП создано! ' + newKP?.evo_quotename,
|
||||
});
|
||||
const leadid = this.getValue('lead');
|
||||
if (newKP?.offerprintformapi)
|
||||
this.stores.calculationUrls.setUrl({
|
||||
name: 'kpUrl',
|
||||
url: String.prototype.concat(CRM_PROXY_URL, newKP?.offerprintformapi),
|
||||
});
|
||||
|
||||
const leadid = this.getValue('lead');
|
||||
CrmService.getCRMOptions<'quotes', IQuote>({
|
||||
query: getQuotesByLeadQuery,
|
||||
variables: {
|
||||
@ -69,10 +75,7 @@ export default async function (this: ICalculationStore) {
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
}).then(({ quotes }) => {
|
||||
if (!quotes || quotes?.length === 0) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
if (!quotes || quotes?.length === 0) throw new Error();
|
||||
this.setOptions('selectQuote', quotes);
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user