diff --git a/web/src/config.js b/web/src/config.js index f4dacc4..e65812e 100644 --- a/web/src/config.js +++ b/web/src/config.js @@ -1,2 +1,3 @@ const __BUILD_VERSION__ = `__BUILD_VERSION__`.replace(/"/g, '') export const BUILD_VERSION = import.meta.env.PROD ? __BUILD_VERSION__ : import.meta.env.MODE; +export const API_URL = 'http://202.103.69.110:6001'; diff --git a/web/src/stores/Hotel.js b/web/src/stores/Hotel.js index 78efbe9..7549e02 100644 --- a/web/src/stores/Hotel.js +++ b/web/src/stores/Hotel.js @@ -1,10 +1,11 @@ import { create } from 'zustand' import { devtools } from 'zustand/middleware' import { fetchJSON } from '@/utils/request' +import { API_URL } from '@/config' export const fetchHotelList = async (hotelName, checkinDateString, checkoutDateString) => { const { errcode, data } = await fetchJSON( - 'http://nas110:6001/search_hotel', + API_URL+'/search_hotel', { keyword: hotelName, checkin: checkinDateString, checkout: checkoutDateString } ) return errcode !== 0 ? {} : data @@ -12,7 +13,7 @@ export const fetchHotelList = async (hotelName, checkinDateString, checkoutDateS export const fetchAvailability = async (hotelId, checkinDateString, checkoutDateString, adultCount=2, roomCount=1) => { const { errcode, data } = await fetchJSON( - 'http://nas110:6001/availability', + API_URL+'/availability', { hotel_id: hotelId, checkin: checkinDateString, checkout: checkoutDateString, adults: adultCount, rooms: roomCount } ) return errcode !== 0 ? {} : data