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