@@ -56,8 +56,8 @@ module.exports = async function ({ plants, nurseries }) {
5656 if ( ! req . body . plantName ) {
5757 return res . status ( 400 ) . json ( { error : "plantName is required" } ) ;
5858 }
59- const baseUrl = process . env . PAC_API_BASE_URL ;
60- const apiKey = process . env . PAC_API_KEY ;
59+ const baseUrl = ( process . env . PAC_API_BASE_URL || "" ) . trim ( ) ;
60+ const apiKey = ( process . env . PAC_API_KEY || "" ) . trim ( ) ;
6161 const url = `${ baseUrl } /Plant/FindVendorsForPlantName` ;
6262 let response = await axios . get ( url , {
6363 headers : { Authorization : "Bearer " + apiKey } ,
@@ -82,8 +82,8 @@ module.exports = async function ({ plants, nurseries }) {
8282 if ( ! req . body . zipCode ) {
8383 return res . status ( 400 ) . json ( { error : "zipCode is required" } ) ;
8484 }
85- const baseUrl = process . env . PAC_API_BASE_URL ;
86- const apiKey = process . env . PAC_API_KEY ;
85+ const baseUrl = ( process . env . PAC_API_BASE_URL || "" ) . trim ( ) ;
86+ const apiKey = ( process . env . PAC_API_KEY || "" ) . trim ( ) ;
8787 const url = `${ baseUrl } /vendor/FindCity` ;
8888 let response = await axios . get ( url , {
8989 headers : { Authorization : "Bearer " + apiKey } ,
@@ -108,8 +108,8 @@ module.exports = async function ({ plants, nurseries }) {
108108 if ( ! req . body . latitude || ! req . body . longitude ) {
109109 return res . status ( 400 ) . json ( { error : "latitude and longitude are required" } ) ;
110110 }
111- const baseUrl = process . env . PAC_API_BASE_URL ;
112- const apiKey = process . env . PAC_API_KEY ;
111+ const baseUrl = ( process . env . PAC_API_BASE_URL || "" ) . trim ( ) ;
112+ const apiKey = ( process . env . PAC_API_KEY || "" ) . trim ( ) ;
113113 const url = `${ baseUrl } /vendor/FindZip` ;
114114 let response = await axios . get ( url , {
115115 headers : { Authorization : "Bearer " + apiKey } ,
@@ -901,7 +901,7 @@ module.exports = async function ({ plants, nurseries }) {
901901
902902 console . log ( "PARAMS" , req . params )
903903 const baseUrl = process . env . PAC_API_BASE_URL ;
904- const apiKey = process . env . PAC_API_KEY ;
904+ const apiKey = ( process . env . PAC_API_KEY || "" ) . trim ( ) ;
905905 const url = `${ baseUrl } /Vendor/FindByState` ;
906906 let response = await axios . get ( url , {
907907 headers : { Authorization : "Bearer " + apiKey } ,
0 commit comments