From a4332b2daec5d67325a029a9fc34275e96a4f923 Mon Sep 17 00:00:00 2001 From: Nastya Date: Wed, 17 Jan 2024 23:04:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B5=D0=B2=20=D1=88=D0=BB=D1=91=D1=82?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D1=8B=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D0=B4=D0=BE=D0=BC=D0=B5=D0=BD,=20=D1=81?= =?UTF-8?q?=D0=B1=D0=B8=D0=BB=D0=B6=D0=B5=D0=BD=D0=BD=D1=8B=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=20-=20=D1=81=D0=B0=D0=BC=20=D0=BD=D0=B0=20=D1=81?= =?UTF-8?q?=D0=B5=D0=B1=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development.local | 1 + .env.production.local | 1 + .gitignore | 2 -- public/index.html | 2 +- src/api/auth.ts | 2 +- src/api/cart.ts | 2 +- src/api/history.ts | 2 +- src/api/price.ts | 2 +- src/api/recentlyPurchasedTariffs.ts | 2 +- src/api/tariff.ts | 2 +- src/api/ticket.ts | 2 +- src/api/user.ts | 2 +- src/api/verification.ts | 2 +- src/api/wallet.ts | 2 +- src/components/FloatingSupportChat/Chat.tsx | 6 +++--- src/components/ProtectedLayout.tsx | 4 ++-- src/index.tsx | 4 ++-- src/pages/History/index.tsx | 2 +- src/pages/Support/CreateTicket.tsx | 2 +- src/pages/Support/SupportChat.tsx | 4 ++-- 20 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 .env.development.local create mode 100644 .env.production.local diff --git a/.env.development.local b/.env.development.local new file mode 100644 index 0000000..2fcfdeb --- /dev/null +++ b/.env.development.local @@ -0,0 +1 @@ +REACT_APP_DOMAIN="https://hub.pena.digital" \ No newline at end of file diff --git a/.env.production.local b/.env.production.local new file mode 100644 index 0000000..c88359d --- /dev/null +++ b/.env.production.local @@ -0,0 +1 @@ +REACT_APP_DOMAIN="" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5605bc8..527e4e6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,9 +14,7 @@ # misc .DS_Store .env.local -.env.development.local .env.test.local -.env.production.local npm-debug.log* yarn-debug.log* diff --git a/public/index.html b/public/index.html index 8de4bb0..59a71d2 100644 --- a/public/index.html +++ b/public/index.html @@ -41,7 +41,7 @@ To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> - + \ No newline at end of file diff --git a/src/api/auth.ts b/src/api/auth.ts index 024c94c..5aad7ed 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -9,7 +9,7 @@ import type { RegisterResponse, } from "@frontend/kitui" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/auth" +const apiUrl = process.env.REACT_APP_DOMAIN + "/auth" console.log("переменная", apiUrl) export async function register( login: string, diff --git a/src/api/cart.ts b/src/api/cart.ts index 7db5e89..6d4bd32 100644 --- a/src/api/cart.ts +++ b/src/api/cart.ts @@ -3,7 +3,7 @@ import { AxiosError } from "axios" import { parseAxiosError } from "@root/utils/parse-error" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/customer" +const apiUrl = process.env.REACT_APP_DOMAIN + "/customer" export async function patchCart( tariffId: string diff --git a/src/api/history.ts b/src/api/history.ts index 6b66e1a..e8dbdad 100644 --- a/src/api/history.ts +++ b/src/api/history.ts @@ -28,7 +28,7 @@ const regList:Record = { export async function getHistory(): Promise<[GetHistoryResponse | null, string?]> { try { const historyResponse = await makeRequest({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/customer/history?page=1&limit=100&type=payCart", + url: process.env.REACT_APP_DOMAIN + "/customer/history?page=1&limit=100&type=payCart", method: "get", useToken: true, }) diff --git a/src/api/price.ts b/src/api/price.ts index 2fdeb5e..ba4570c 100644 --- a/src/api/price.ts +++ b/src/api/price.ts @@ -4,7 +4,7 @@ import { parseAxiosError } from "@root/utils/parse-error" import type { GetDiscountsResponse } from "@root/model/discount" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/price" +const apiUrl = process.env.REACT_APP_DOMAIN + "/price" export async function getDiscounts(signal: AbortSignal | undefined): Promise<[GetDiscountsResponse | null, string?]> { try { diff --git a/src/api/recentlyPurchasedTariffs.ts b/src/api/recentlyPurchasedTariffs.ts index 1d19de1..9e09f5e 100644 --- a/src/api/recentlyPurchasedTariffs.ts +++ b/src/api/recentlyPurchasedTariffs.ts @@ -4,7 +4,7 @@ import { parseAxiosError } from "@root/utils/parse-error" export async function getRecentlyPurchasedTariffs(): Promise<[any | null, string?]> { try { const recentlyPurchased = await makeRequest({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/customer/recent", + url: process.env.REACT_APP_DOMAIN + "/customer/recent", method: "get", useToken: true, }) diff --git a/src/api/tariff.ts b/src/api/tariff.ts index 64daa8c..f5a6ddb 100644 --- a/src/api/tariff.ts +++ b/src/api/tariff.ts @@ -5,7 +5,7 @@ import { parseAxiosError } from "@root/utils/parse-error" import type { ServiceKeyToPrivilegesMap } from "@root/model/privilege" import type { GetTariffsResponse } from "@root/model/tariff" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/strator" +const apiUrl = process.env.REACT_APP_DOMAIN + "/strator" export async function getTariffs( apiPage: number, diff --git a/src/api/ticket.ts b/src/api/ticket.ts index 01a9d1d..ea95931 100644 --- a/src/api/ticket.ts +++ b/src/api/ticket.ts @@ -3,7 +3,7 @@ import { parseAxiosError } from "@root/utils/parse-error" import { SendTicketMessageRequest } from "@frontend/kitui" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/heruvym" +const apiUrl = process.env.REACT_APP_DOMAIN + "/heruvym" export async function sendTicketMessage( ticketId: string, diff --git a/src/api/user.ts b/src/api/user.ts index 2cd4121..ab73d4a 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -2,7 +2,7 @@ import { User, makeRequest } from "@frontend/kitui" import { PatchUserRequest } from "@root/model/user" import { parseAxiosError } from "@root/utils/parse-error" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/user" +const apiUrl = process.env.REACT_APP_DOMAIN + "/user" export async function patchUser( user: PatchUserRequest diff --git a/src/api/verification.ts b/src/api/verification.ts index 75b8fd9..974f511 100644 --- a/src/api/verification.ts +++ b/src/api/verification.ts @@ -9,7 +9,7 @@ import type { UpdateDocumentsArgs, } from "@root/model/auth" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/verification" +const apiUrl = process.env.REACT_APP_DOMAIN + "/verification" export async function verification( userId: string diff --git a/src/api/wallet.ts b/src/api/wallet.ts index 56be29e..9b9d0c5 100644 --- a/src/api/wallet.ts +++ b/src/api/wallet.ts @@ -2,7 +2,7 @@ import { makeRequest } from "@frontend/kitui" import { SendPaymentRequest, SendPaymentResponse } from "@root/model/wallet" import { parseAxiosError } from "@root/utils/parse-error" -const apiUrl = "https://" + process.env.REACT_APP_DOMAIN + "/customer" +const apiUrl = process.env.REACT_APP_DOMAIN + "/customer" const testPaymentBody: SendPaymentRequest = { type: "bankCard", diff --git a/src/components/FloatingSupportChat/Chat.tsx b/src/components/FloatingSupportChat/Chat.tsx index 18f53dc..c84da71 100644 --- a/src/components/FloatingSupportChat/Chat.tsx +++ b/src/components/FloatingSupportChat/Chat.tsx @@ -62,7 +62,7 @@ export default function Chat({ sx }: Props) { const chatBoxRef = useRef(null) useTicketMessages({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/heruvym/getMessages", + url: process.env.REACT_APP_DOMAIN + "/heruvym/getMessages", isUnauth: true, ticketId: sessionData?.ticketId, messagesPerPage, @@ -81,7 +81,7 @@ export default function Chat({ sx }: Props) { useSSESubscription({ enabled: Boolean(sessionData), - url: "https://" + process.env.REACT_APP_DOMAIN + `/heruvym/ticket?ticket=${sessionData?.ticketId}&s=${sessionData?.sessionId}`, + url: process.env.REACT_APP_DOMAIN + `/heruvym/ticket?ticket=${sessionData?.ticketId}&s=${sessionData?.sessionId}`, onNewData: addOrUpdateUnauthMessages, onDisconnect: useCallback(() => { setUnauthIsPreventAutoscroll(false) @@ -131,7 +131,7 @@ export default function Chat({ sx }: Props) { if (!sessionData) { setIsMessageSending(true) createTicket({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/heruvym/create", + url: process.env.REACT_APP_DOMAIN + "/heruvym/create", body: { Title: "Unauth title", Message: messageField, diff --git a/src/components/ProtectedLayout.tsx b/src/components/ProtectedLayout.tsx index 4065f90..1ea76db 100644 --- a/src/components/ProtectedLayout.tsx +++ b/src/components/ProtectedLayout.tsx @@ -25,7 +25,7 @@ export default function ProtectedLayout() { const ticketsPerPage = useTicketStore((state) => state.ticketsPerPage) useSSESubscription({ - url: "https://" + process.env.REACT_APP_DOMAIN + `/heruvym/subscribe?Authorization=${token}`, + url: process.env.REACT_APP_DOMAIN + `/heruvym/subscribe?Authorization=${token}`, onNewData: (data) => { updateTickets(data.filter((d) => Boolean(d.id))) setTicketCount(data.length) @@ -34,7 +34,7 @@ export default function ProtectedLayout() { }) useTicketsFetcher({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/heruvym/getTickets", + url: process.env.REACT_APP_DOMAIN + "/heruvym/getTickets", ticketsPerPage, ticketApiPage, onSuccess: (result) => { diff --git a/src/index.tsx b/src/index.tsx index e453dd1..61a5933 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -39,7 +39,7 @@ const App = () => { const navigate = useNavigate() useUserFetcher({ - url: "https://" + process.env.REACT_APP_DOMAIN + `/user/${userId}`, + url: process.env.REACT_APP_DOMAIN + `/user/${userId}`, userId, onNewUser: setUser, onError: (error) => { @@ -53,7 +53,7 @@ const App = () => { }) useUserAccountFetcher({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/customer/account", + url: process.env.REACT_APP_DOMAIN + "/customer/account", userId, onNewUserAccount: setUserAccount, onError: (error) => { diff --git a/src/pages/History/index.tsx b/src/pages/History/index.tsx index eb66c78..2eec7f7 100644 --- a/src/pages/History/index.tsx +++ b/src/pages/History/index.tsx @@ -40,7 +40,7 @@ export default function History() { try { await makeRequest ( { - url: "https://" + process.env.REACT_APP_DOMAIN + `/customer/sendReport/${tariffId}`, + url: process.env.REACT_APP_DOMAIN + `/customer/sendReport/${tariffId}`, method: "POST", } ) diff --git a/src/pages/Support/CreateTicket.tsx b/src/pages/Support/CreateTicket.tsx index 0c31f89..77e03f4 100644 --- a/src/pages/Support/CreateTicket.tsx +++ b/src/pages/Support/CreateTicket.tsx @@ -17,7 +17,7 @@ export default function CreateTicket() { if (!ticketBodyField || !ticketNameField) return createTicket({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/heruvym/create", + url: process.env.REACT_APP_DOMAIN + "/heruvym/create", body: { Title: ticketNameField, Message: ticketBodyField, diff --git a/src/pages/Support/SupportChat.tsx b/src/pages/Support/SupportChat.tsx index 03e5c07..f51136e 100644 --- a/src/pages/Support/SupportChat.tsx +++ b/src/pages/Support/SupportChat.tsx @@ -58,7 +58,7 @@ function SupportChat() { const fetchState = useMessageStore((state) => state.ticketMessageFetchState) useTicketMessages({ - url: "https://" + process.env.REACT_APP_DOMAIN + "/heruvym/getMessages", + url: process.env.REACT_APP_DOMAIN + "/heruvym/getMessages", ticketId, messagesPerPage, messageApiPage, @@ -76,7 +76,7 @@ function SupportChat() { useSSESubscription({ enabled: Boolean(token) && Boolean(ticketId), - url: "https://" + process.env.REACT_APP_DOMAIN + `/heruvym/ticket?ticket=${ticketId}&Authorization=${token}`, + url: process.env.REACT_APP_DOMAIN + `/heruvym/ticket?ticket=${ticketId}&Authorization=${token}`, onNewData: addOrUpdateMessages, onDisconnect: useCallback(() => { clearMessageState()