File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ export const createRequest = (
88 getToken : ( ) => Promise < string | null > ,
99 baseUrl : string ,
1010) => {
11- const hardCodedHotelId = "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"
1211 return async < T > ( config : RequestConfig ) : Promise < T > => {
12+ const hotelId = getConfig ( ) . hotelId ;
1313 let fullUrl = `${ baseUrl } ${ config . url } ` ;
1414 if ( config . params && Object . keys ( config . params ) . length > 0 ) {
1515 const searchParams = new URLSearchParams ( config . params ) ;
16- fullUrl += '?' + searchParams . toString ( ) ;
16+ fullUrl += "?" + searchParams . toString ( ) ;
1717 }
1818
1919 try {
@@ -24,7 +24,7 @@ export const createRequest = (
2424 headers : {
2525 "Content-Type" : "application/json" ,
2626 ...( token && { Authorization : `Bearer ${ token } ` } ) ,
27- "X-Hotel-ID" : hardCodedHotelId ,
27+ "X-Hotel-ID" : hotelId ,
2828 ...config . headers ,
2929 } ,
3030 body : config . data ? JSON . stringify ( config . data ) : undefined ,
@@ -100,10 +100,5 @@ export const getBaseUrl = (): string => {
100100 throw new Error ( "API_BASE_URL is not configured. Check your .env file." ) ;
101101 }
102102
103- const trimmed = url . replace ( / \/ + $ / , "" ) ;
104- if ( trimmed . endsWith ( "/api/v1" ) ) {
105- return trimmed ;
106- }
107-
108- return `${ trimmed } /api/v1` ;
103+ return url ;
109104} ;
You can’t perform that action at this time.
0 commit comments