DONE: update to use ip for the api in frontend
This commit is contained in:
@@ -1 +1,2 @@
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Baked into the admin image at build time (Gitea secret VITE_API_URL)
|
||||
VITE_API_URL=https://qms-api.erahn.com.my
|
||||
VITE_BRANCH_QR_BASE_URL=https://qms-customer.erahn.com.my
|
||||
|
||||
@@ -3,7 +3,9 @@ FROM node:20-bookworm AS build
|
||||
WORKDIR /app
|
||||
|
||||
ARG VITE_API_URL=http://localhost:8080
|
||||
ARG VITE_BRANCH_QR_BASE_URL=http://localhost:3000
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
ENV VITE_BRANCH_QR_BASE_URL=$VITE_BRANCH_QR_BASE_URL
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export const SERVER_URL = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const CUSTOMER_APP_URL = 'https://qms-customer.erahn.com.my';
|
||||
/** Public base URL encoded into branch QR codes (ManageBranchesScreen only). */
|
||||
export const BRANCH_QR_BASE_URL =
|
||||
import.meta.env.VITE_BRANCH_QR_BASE_URL ?? 'http://localhost:3000';
|
||||
|
||||
export const ROLES = {
|
||||
ROLE_SUPER_ADMIN: 'ROLE_SUPER_ADMIN',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import QRCode from 'qrcode';
|
||||
import { CUSTOMER_APP_URL } from '../constants.js';
|
||||
import { BRANCH_QR_BASE_URL } from '../constants.js';
|
||||
|
||||
const DEFAULT_QR_SECRET = 'qms-branch-qr-v1';
|
||||
|
||||
@@ -54,7 +54,7 @@ export function decodeBranchQrToken(token, secret = getQrSecret()) {
|
||||
}
|
||||
|
||||
export function getBranchTicketUrl(tenantCode, branchId) {
|
||||
const base = CUSTOMER_APP_URL.replace(/\/$/, '');
|
||||
const base = BRANCH_QR_BASE_URL.replace(/\/$/, '');
|
||||
const token = encodeBranchQrToken(tenantCode, branchId);
|
||||
return `${base}/q/${token}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user