From 56919d40041586446dcf337576aca75e3ec5f55c Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 13 Sep 2024 14:18:45 +0800 Subject: [PATCH] conf: api url --- web/src/config.js | 1 + web/src/stores/Hotel.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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