fix: download-kp url
This commit is contained in:
parent
f4acf8c316
commit
befa92fbce
@ -12,7 +12,6 @@ const serverRuntimeConfigSchema = envSchema.pick({
|
||||
URL_CORE_CALCULATE_DIRECT: true,
|
||||
URL_CORE_FINGAP_DIRECT: true,
|
||||
URL_CRM_CREATEKP_DIRECT: true,
|
||||
URL_CRM_DOWNLOADKP_BASE: true,
|
||||
URL_CRM_GRAPHQL_DIRECT: true,
|
||||
URL_ELT_KASKO_DIRECT: true,
|
||||
URL_ELT_OSAGO_DIRECT: true,
|
||||
|
||||
@ -8,6 +8,10 @@ const { serverRuntimeConfig, publicRuntimeConfig } = getConfig();
|
||||
function getUrls() {
|
||||
const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
function withBasePath(url: string) {
|
||||
return BASE_PATH + url;
|
||||
}
|
||||
|
||||
if (isServer()) {
|
||||
const {
|
||||
URL_CRM_GRAPHQL_DIRECT,
|
||||
@ -16,7 +20,6 @@ function getUrls() {
|
||||
URL_1C_TRANSTAX_DIRECT,
|
||||
URL_CORE_CALCULATE_DIRECT,
|
||||
URL_CRM_CREATEKP_DIRECT,
|
||||
URL_CRM_DOWNLOADKP_BASE,
|
||||
PORT,
|
||||
URL_ELT_KASKO_DIRECT,
|
||||
URL_ELT_OSAGO_DIRECT,
|
||||
@ -29,7 +32,7 @@ function getUrls() {
|
||||
URL_CORE_CALCULATE: URL_CORE_CALCULATE_DIRECT,
|
||||
URL_CORE_FINGAP: URL_CORE_FINGAP_DIRECT,
|
||||
URL_CRM_CREATEKP: URL_CRM_CREATEKP_DIRECT,
|
||||
URL_CRM_DOWNLOADKP_BASE,
|
||||
URL_CRM_DOWNLOADKP: withBasePath(urls.URL_CRM_DOWNLOADKP_PROXY),
|
||||
URL_CRM_GRAPHQL: URL_CRM_GRAPHQL_DIRECT,
|
||||
URL_ELT_KASKO: URL_ELT_KASKO_DIRECT,
|
||||
URL_ELT_OSAGO: URL_ELT_OSAGO_DIRECT,
|
||||
@ -37,16 +40,13 @@ function getUrls() {
|
||||
};
|
||||
}
|
||||
|
||||
function withBasePath(url: string) {
|
||||
return BASE_PATH + url;
|
||||
}
|
||||
|
||||
return {
|
||||
BASE_PATH,
|
||||
URL_1C_TRANSTAX: withBasePath(urls.URL_1C_TRANSTAX_PROXY),
|
||||
URL_CORE_CALCULATE: withBasePath(urls.URL_CORE_CALCULATE_PROXY),
|
||||
URL_CORE_FINGAP: withBasePath(urls.URL_CORE_FINGAP_PROXY),
|
||||
URL_CRM_CREATEKP: withBasePath(urls.URL_CRM_CREATEKP_PROXY),
|
||||
URL_CRM_DOWNLOADKP: withBasePath(urls.URL_CRM_DOWNLOADKP_PROXY),
|
||||
URL_CRM_GRAPHQL: withBasePath(urls.URL_CRM_GRAPHQL_PROXY),
|
||||
URL_ELT_KASKO: withBasePath(urls.URL_ELT_KASKO_PROXY),
|
||||
URL_ELT_OSAGO: withBasePath(urls.URL_ELT_OSAGO_PROXY),
|
||||
|
||||
@ -3,6 +3,7 @@ module.exports = {
|
||||
URL_CORE_CALCULATE_PROXY: '/api/core/calculate',
|
||||
URL_CORE_FINGAP_PROXY: '/api/core/fingap',
|
||||
URL_CRM_CREATEKP_PROXY: '/api/crm/create-kp',
|
||||
URL_CRM_DOWNLOADKP_PROXY: '/api/crm/download-kp',
|
||||
URL_CRM_GRAPHQL_PROXY: '/api/graphql/crm',
|
||||
URL_ELT_KASKO_PROXY: '/api/elt/kasko',
|
||||
URL_ELT_OSAGO_PROXY: '/api/elt/osago',
|
||||
|
||||
@ -44,6 +44,10 @@ const nextConfig = {
|
||||
destination: env.URL_CRM_GRAPHQL_DIRECT,
|
||||
source: urls.URL_CRM_GRAPHQL_PROXY,
|
||||
},
|
||||
{
|
||||
destination: env.URL_CRM_DOWNLOADKP_BASE + '/:path*',
|
||||
source: urls.URL_CRM_DOWNLOADKP_PROXY + '/:path*',
|
||||
},
|
||||
{
|
||||
destination: env.URL_GET_USER_DIRECT,
|
||||
source: urls.URL_GET_USER_PROXY,
|
||||
|
||||
@ -49,7 +49,7 @@ const defaultInsurance = {
|
||||
const defaultFingap = { keys: [] };
|
||||
const defaultPayments = { values: [], sums: [] };
|
||||
|
||||
const { URL_CRM_DOWNLOADKP_BASE } = getUrls();
|
||||
const { URL_CRM_DOWNLOADKP } = getUrls();
|
||||
|
||||
export const quoteRouter = router({
|
||||
getQuote: publicProcedure
|
||||
@ -166,10 +166,8 @@ export const quoteRouter = router({
|
||||
responseCalculate: calculateResult,
|
||||
});
|
||||
|
||||
if (URL_CRM_DOWNLOADKP_BASE) {
|
||||
result.values.downloadKp = URL_CRM_DOWNLOADKP_BASE?.concat(
|
||||
createKPResult.offerprintformapi
|
||||
);
|
||||
if (URL_CRM_DOWNLOADKP) {
|
||||
result.values.downloadKp = URL_CRM_DOWNLOADKP?.concat(createKPResult.offerprintformapi);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user