переменное окружение, ссылки на доки
This commit is contained in:
parent
dc4edf9be7
commit
ac2d91d320
2
.env.development.local
Normal file
2
.env.development.local
Normal file
@ -0,0 +1,2 @@
|
||||
REACT_APP_DOMAIN="https://squiz.pena.digital"
|
||||
REACT_APP_HUB_DOMAIN="https://shub.pena.digital"
|
2
.env.production.local
Normal file
2
.env.production.local
Normal file
@ -0,0 +1,2 @@
|
||||
REACT_APP_DOMAIN="https://squiz.pena.digital"
|
||||
REACT_APP_HUB_DOMAIN="https://shub.pena.digital"
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,9 +14,7 @@
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
@ -124,7 +124,7 @@ export default function App() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useUserFetcher({
|
||||
url: `https://squiz.pena.digital/user/${userId}`,
|
||||
url: process.env.REACT_APP_DOMAIN + `/user/${userId}`,
|
||||
userId,
|
||||
onNewUser: setUser,
|
||||
onError: (error) => {
|
||||
@ -138,7 +138,7 @@ export default function App() {
|
||||
});
|
||||
|
||||
useUserAccountFetcher({
|
||||
url: "https://squiz.pena.digital/customer/account",
|
||||
url: process.env.REACT_APP_DOMAIN + "/customer/account",
|
||||
userId,
|
||||
onNewUserAccount: setCustomerAccount,
|
||||
onError: (error) => {
|
||||
@ -153,7 +153,7 @@ export default function App() {
|
||||
});
|
||||
|
||||
useUserAccountFetcher({
|
||||
url: "https://squiz.pena.digital/squiz/account/get",
|
||||
url: process.env.REACT_APP_DOMAIN + "/squiz/account/get",
|
||||
userId,
|
||||
onNewUserAccount: setUserAccount,
|
||||
onError: (error) => {
|
||||
|
@ -8,10 +8,7 @@ import type {
|
||||
} from "@frontend/kitui";
|
||||
import { parseAxiosError } from "../utils/parse-error";
|
||||
|
||||
const apiUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "/auth"
|
||||
: "https://squiz.pena.digital/auth";
|
||||
const apiUrl =process.env.REACT_APP_DOMAIN + "/auth";
|
||||
|
||||
export async function register(
|
||||
login: string,
|
||||
|
@ -1,15 +1,12 @@
|
||||
import axios from "axios";
|
||||
|
||||
const domen =
|
||||
window.location.hostname === "localhost"
|
||||
? "squiz.pena.digital"
|
||||
: window.location.hostname;
|
||||
const domen = process.env.REACT_APP_HUB_DOMAIN
|
||||
|
||||
export function sendContactFormRequest(body: {
|
||||
contact: string;
|
||||
whoami: string;
|
||||
}) {
|
||||
return axios(`https://${domen}/feedback/callme`, {
|
||||
return axios(`${domen}/feedback/callme`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@ -19,10 +19,7 @@ import {
|
||||
} from "@model/question/copy";
|
||||
import { replaceSpacesToEmptyLines } from "../utils/replaceSpacesToEmptyLines";
|
||||
|
||||
const baseUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "/squiz"
|
||||
: "https://squiz.pena.digital/squiz";
|
||||
const baseUrl = process.env.REACT_APP_DOMAIN + "/squiz";
|
||||
|
||||
function createQuestion(body: CreateQuestionRequest) {
|
||||
return makeRequest<CreateQuestionRequest, RawQuestion>({
|
||||
|
@ -8,14 +8,8 @@ import { GetQuizRequest, GetQuizResponse } from "model/quiz/get";
|
||||
import { GetQuizListRequest, GetQuizListResponse } from "model/quiz/getList";
|
||||
import { RawQuiz } from "model/quiz/quiz";
|
||||
|
||||
const baseUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "/squiz"
|
||||
: "https://squiz.pena.digital/squiz";
|
||||
const imagesUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "/squizstorer"
|
||||
: "https://squiz.pena.digital/squizstorer";
|
||||
const baseUrl = process.env.REACT_APP_DOMAIN + "/squiz";
|
||||
const imagesUrl = process.env.REACT_APP_DOMAIN + "/squizstorer";
|
||||
|
||||
function createQuiz(body?: Partial<CreateQuizRequest>) {
|
||||
return makeRequest<CreateQuizRequest, RawQuiz>({
|
||||
|
@ -18,10 +18,7 @@ import {
|
||||
CopyQuestionResponse,
|
||||
} from "@model/question/copy";
|
||||
|
||||
const baseUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? "/squiz"
|
||||
: "https://squiz.pena.digital";
|
||||
const baseUrl = process.env.REACT_APP_DOMAIN ;
|
||||
|
||||
function get(quizId: string) {
|
||||
return makeRequest<any>({
|
||||
@ -33,7 +30,7 @@ function get(quizId: string) {
|
||||
|
||||
function quizRelase(quizId: string, status: "start" | "stop") {
|
||||
return makeRequest<any>({
|
||||
url: `https://squiz.pena.digital/answer/quiz/get`,
|
||||
url: process.env.REACT_APP_DOMAIN + `/answer/quiz/get`,
|
||||
body: {
|
||||
quiz_id: quizId,
|
||||
limit: 100,
|
||||
|
@ -122,11 +122,19 @@ export default function Component() {
|
||||
<Button
|
||||
variant="text"
|
||||
sx={{ fontSize: "16px", fontWeight: 500, color: "white" }}
|
||||
href={"https://shub.pena.digital/docs/oferta"}
|
||||
href={"https://hub.pena.digital/docs/oferta"}
|
||||
target="_blank"
|
||||
>
|
||||
Пользовательское соглашение
|
||||
</Button>
|
||||
<Button
|
||||
variant="text"
|
||||
sx={{ fontSize: "16px", fontWeight: 500, color: "white" }}
|
||||
href={"https://hub.pena.digital/docs/privacy"}
|
||||
target="_blank"
|
||||
>
|
||||
Политика конфиденциальности
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
|
@ -57,7 +57,7 @@ function TariffPage() {
|
||||
GetTariffsResponse
|
||||
>({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/strator/tariff?page=1&limit=100",
|
||||
url: process.env.REACT_APP_DOMAIN + "/strator/tariff?page=1&limit=100",
|
||||
});
|
||||
|
||||
tariffsList.push(...tariffs);
|
||||
@ -65,7 +65,7 @@ function TariffPage() {
|
||||
for (let page = 2; page <= totalPages; page += 1) {
|
||||
const tariffsResult = await makeRequest<never, GetTariffsResponse>({
|
||||
method: "GET",
|
||||
url: `https://squiz.pena.digital/strator/tariff?page=${page}&limit=100`,
|
||||
url: process.env.REACT_APP_DOMAIN + `/strator/tariff?page=${page}&limit=100`,
|
||||
});
|
||||
console.log(page);
|
||||
|
||||
@ -80,12 +80,12 @@ function TariffPage() {
|
||||
const get = async () => {
|
||||
const user = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/customer/account",
|
||||
url: process.env.REACT_APP_DOMAIN + "/customer/account",
|
||||
});
|
||||
const tariffsList = await getTariffsList();
|
||||
const discounts = await makeRequest({
|
||||
method: "GET",
|
||||
url: "https://squiz.pena.digital/price/discounts",
|
||||
url: process.env.REACT_APP_DOMAIN + "/price/discounts",
|
||||
});
|
||||
setUser(user);
|
||||
console.log("это то что мы получили в самом конце", tariffsList);
|
||||
@ -109,14 +109,14 @@ function TariffPage() {
|
||||
//Добавляем желаемый тариф в корзину
|
||||
await makeRequest({
|
||||
method: "PATCH",
|
||||
url: `https://hub.pena.digital/customer/cart?id=${id}`,
|
||||
url: process.env.REACT_APP_HUB_DOMAIN + `/customer/cart?id=${id}`,
|
||||
});
|
||||
//Если нам хватает денежек - покупаем тариф
|
||||
if (price <= user.wallet.cash) {
|
||||
try {
|
||||
const data = await makeRequest({
|
||||
method: "POST",
|
||||
url: "https://squiz.pena.digital/customer/cart/pay",
|
||||
url: process.env.REACT_APP_DOMAIN + "/customer/cart/pay",
|
||||
});
|
||||
setCash(currencyFormatter.format(Number(data.wallet.cash) / 100));
|
||||
enqueueSnackbar("Тариф успешно приобретён");
|
||||
@ -130,7 +130,7 @@ function TariffPage() {
|
||||
// history.pushState({}, null, "https://hub.pena.digital/wallet?action=squizpay");
|
||||
|
||||
var link = document.createElement("a");
|
||||
link.href = `https://hub.pena.digital/payment?action=squizpay&dif=${
|
||||
link.href = process.env.REACT_APP_HUB_DOMAIN + `/payment?action=squizpay&dif=${
|
||||
(price - Number(user.wallet.cash)) * 100
|
||||
}`;
|
||||
document.body.appendChild(link);
|
||||
@ -300,7 +300,7 @@ export const inCart = () => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "PATCH",
|
||||
url: `https://hub.pena.digital/customer/cart?id=${id}`,
|
||||
url: process.env.REACT_APP_HUB_DOMAIN + `/customer/cart?id=${id}`,
|
||||
});
|
||||
|
||||
let index = saveCart.indexOf("green");
|
||||
@ -322,7 +322,7 @@ const outCart = (cart: string[]) => {
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "DELETE",
|
||||
url: `https://squiz.pena.digital/customer/cart?id=${id}`,
|
||||
url: process.env.REACT_APP_DOMAIN + `/customer/cart?id=${id}`,
|
||||
});
|
||||
let saveCart = JSON.parse(localStorage.getItem("saveCart") || "[]");
|
||||
saveCart = saveCart.push(id);
|
||||
|
@ -222,13 +222,13 @@ export const ContactForm = ({
|
||||
/>
|
||||
<Typography sx={{ color: theme.palette.text.primary }}>
|
||||
С 
|
||||
<Link href={"https://shub.pena.digital/ppdd"} target="_blank">
|
||||
<Link href={"https://hub.pena.digital/ppdd"} target="_blank">
|
||||
{" "}
|
||||
Положением об обработке персональных данных{" "}
|
||||
</Link>
|
||||
 и 
|
||||
<Link
|
||||
href={"https://shub.pena.digital/docs/privacy"}
|
||||
href={"https://hub.pena.digital/docs/privacy"}
|
||||
target="_blank"
|
||||
>
|
||||
{" "}
|
||||
|
@ -50,7 +50,7 @@ export default function QuizCard({
|
||||
try {
|
||||
await makeRequest({
|
||||
method: "POST",
|
||||
url: "https://squiz.pena.digital/customer/cart/pay",
|
||||
url: process.env.REACT_APP_DOMAIN + "/customer/cart/pay",
|
||||
});
|
||||
inCart();
|
||||
} catch (e) {
|
||||
|
@ -413,7 +413,7 @@ export const uploadQuestionImage = async (
|
||||
}
|
||||
|
||||
const imageId = values[0];
|
||||
const imageUrl = `https://squiz.pena.digital/squizimages/${quizQid}/${imageId}`;
|
||||
const imageUrl = process.env.REACT_APP_DOMAIN + `/squizimages/${quizQid}/${imageId}`;
|
||||
|
||||
updateQuestion(questionId, (question) => {
|
||||
updateFn(question, imageUrl);
|
||||
|
@ -129,7 +129,7 @@ export const quizStore = create<QuizStore>()(
|
||||
config: {
|
||||
noStartPage: false,
|
||||
type: "", // quiz или form
|
||||
logo: "hub.pena.digital/img/logo",
|
||||
logo: process.env.REACT_APP_HUB_DOMAIN + "/img/logo",
|
||||
startpage: {
|
||||
description: "", // приветственный текст опроса
|
||||
button: "", // текст на кнопке начала опроса
|
||||
|
@ -269,7 +269,7 @@ export const uploadQuizImage = async (
|
||||
updateQuiz(quizId, (quiz) => {
|
||||
updateFn(
|
||||
quiz,
|
||||
`https://squiz.pena.digital/squizimages/${quiz.qid}/${imageId}`,
|
||||
process.env.REACT_APP_DOMAIN + `/squizimages/${quiz.qid}/${imageId}`,
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user