refactor: base origin

This commit is contained in:
Tristan Yang
2023-02-23 22:19:24 +08:00
parent 6d28e7d649
commit d10df4bee5
2 changed files with 8 additions and 6 deletions
+6 -5
View File
@@ -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) {
+2 -1
View File
@@ -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 = () => {
<div className="flex flex-col gap-2">
<span className="text-gray-400 dark:text-gray-200 my-3 text-sm">{t("guest_login_tip")}</span>
<div className="w-44 h-44 self-center mb-4">
<QRCode size={1200} link={`https://voce.chat/login?s=${encodeURIComponent(location.origin)}`} />
<QRCode size={1200} link={`https://voce.chat/login?s=${encodeURIComponent(BASE_ORIGIN)}`} />
</div>
<Button onClick={handleSignIn} className="small">{t("sign_in")}</Button>
</div>