From d10df4bee5a33731d4e351c31be6724a232ad8c7 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Thu, 23 Feb 2023 22:19:24 +0800 Subject: [PATCH] refactor: base origin --- src/app/config.ts | 11 ++++++----- src/routes/chat/GuestBlankPlaceholder.tsx | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/config.ts b/src/app/config.ts index b706a9cb..87e97b52 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -1,11 +1,6 @@ import i18n from '../i18n'; import { Price } from "../types/common"; -// const BASE_URL = `http://localhost:3333/api`; -const BASE_URL = process.env.REACT_APP_RELEASE - ? `${location.origin}/api` - : `https://dev.voce.chat/api`; - let prices: Price[] = [ { type: "payment", @@ -16,6 +11,12 @@ let prices: Price[] = [ type: "booking", } ]; + +// export const BASE_ORIGIN = `http://localhost:3333`; +export const BASE_ORIGIN = process.env.REACT_APP_RELEASE + ? `${location.origin}` + : `https://dev.voce.chat`; +const BASE_URL = `${BASE_ORIGIN}/api`; export const getLicensePriceList = () => { const ps = prices.map((p, idx) => { switch (idx) { diff --git a/src/routes/chat/GuestBlankPlaceholder.tsx b/src/routes/chat/GuestBlankPlaceholder.tsx index bead7024..a39837b2 100644 --- a/src/routes/chat/GuestBlankPlaceholder.tsx +++ b/src/routes/chat/GuestBlankPlaceholder.tsx @@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; import { useNavigate } from "react-router-dom"; +import { BASE_ORIGIN } from "../../app/config"; import { resetAuthData } from "../../app/slices/auth.data"; import { useAppSelector } from "../../app/store"; import QRCode from "../../common/component/QRCode"; @@ -26,7 +27,7 @@ const GuestBlankPlaceholder = () => {
{t("guest_login_tip")}
- +