fix: conflicts resolved
This commit is contained in:
commit
81fae9ad4c
@ -67,7 +67,7 @@ export async function logout(): Promise<[unknown, string?]> {
|
|||||||
} catch (nativeError) {
|
} catch (nativeError) {
|
||||||
const [error] = parseAxiosError(nativeError);
|
const [error] = parseAxiosError(nativeError);
|
||||||
|
|
||||||
return [null, `Не удалось выйти. ${error}`];
|
//return [null, `Не удалось выйти. ${error}`];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +282,11 @@ export const Answers: FC<AnswersProps> = ({ data }) => {
|
|||||||
<NextIcon />
|
<NextIcon />
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
</Box>
|
</Box>
|
||||||
{currentAnswerExtended.map((element, index) => (
|
{currentAnswerExtended.map(([title, percent], index) => (
|
||||||
<Answer
|
<Answer
|
||||||
key={index}
|
key={index}
|
||||||
title={element[0]}
|
title={title}
|
||||||
percent={element[1]}
|
percent={percent}
|
||||||
highlight={!index}
|
highlight={!index}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
@ -354,7 +354,7 @@ export const ResultCard = ({ resultContract, resultData }: Props) => {
|
|||||||
|
|
||||||
<MediaSelectionAndDisplay
|
<MediaSelectionAndDisplay
|
||||||
resultData={resultData}
|
resultData={resultData}
|
||||||
cropAspectRatio={{ width: 844, height: 305.9 }}
|
cropAspectRatio={{ width: 305.9, height: 305.9 }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{buttonPlus ? (
|
{buttonPlus ? (
|
||||||
|
@ -30,6 +30,7 @@ import { Tabs } from "./Tabs";
|
|||||||
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
||||||
import { currencyFormatter } from "./tariffsUtils/currencyFormatter";
|
import { currencyFormatter } from "./tariffsUtils/currencyFormatter";
|
||||||
import { useWallet, setCash } from "@root/cash";
|
import { useWallet, setCash } from "@root/cash";
|
||||||
|
import { handleLogoutClick } from "@utils/HandleLogoutClick";
|
||||||
|
|
||||||
const StepperText: Record<string, string> = {
|
const StepperText: Record<string, string> = {
|
||||||
day: "Тарифы на время",
|
day: "Тарифы на время",
|
||||||
@ -173,20 +174,6 @@ function TariffPage() {
|
|||||||
return tariff.privileges[0].privilegeId !== "squizHideBadge";
|
return tariff.privileges[0].privilegeId !== "squizHideBadge";
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleLogoutClick() {
|
|
||||||
const [, logoutError] = await logout();
|
|
||||||
|
|
||||||
if (logoutError) {
|
|
||||||
return enqueueSnackbar(logoutError);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanAuthTicketData();
|
|
||||||
clearAuthToken();
|
|
||||||
clearUserData();
|
|
||||||
clearQuizData();
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleApplyPromocode() {
|
function handleApplyPromocode() {
|
||||||
if (!promocodeField) return;
|
if (!promocodeField) return;
|
||||||
|
|
||||||
@ -241,7 +228,10 @@ function TariffPage() {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<LogoutButton
|
<LogoutButton
|
||||||
onClick={handleLogoutClick}
|
onClick={() => {
|
||||||
|
navigate("/");
|
||||||
|
handleLogoutClick();
|
||||||
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
ml: "20px",
|
ml: "20px",
|
||||||
}}
|
}}
|
||||||
|
@ -13,17 +13,12 @@ import {
|
|||||||
import { updateQuiz } from "@root/quizes/actions";
|
import { updateQuiz } from "@root/quizes/actions";
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
|
|
||||||
import { enqueueSnackbar } from "notistack";
|
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
||||||
import { clearUserData } from "@root/user";
|
|
||||||
import { clearAuthToken } from "@frontend/kitui";
|
|
||||||
import { logout } from "@api/auth";
|
|
||||||
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
||||||
import CustomTextField from "@ui_kit/CustomTextField";
|
import CustomTextField from "@ui_kit/CustomTextField";
|
||||||
import { cleanAuthTicketData } from "@root/ticket";
|
import { handleLogoutClick } from "@utils/HandleLogoutClick";
|
||||||
import { clearQuizData } from "@root/quizes/store";
|
|
||||||
|
|
||||||
type HeaderProps = {
|
type HeaderProps = {
|
||||||
setMobileSidebar: (callback: (visible: boolean) => boolean) => void;
|
setMobileSidebar: (callback: (visible: boolean) => boolean) => void;
|
||||||
@ -37,20 +32,6 @@ export const Header = ({ setMobileSidebar, scrollDown }: HeaderProps) => {
|
|||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
||||||
|
|
||||||
async function handleLogoutClick() {
|
|
||||||
const [, logoutError] = await logout();
|
|
||||||
|
|
||||||
if (logoutError) {
|
|
||||||
return enqueueSnackbar(logoutError);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanAuthTicketData();
|
|
||||||
clearAuthToken();
|
|
||||||
clearUserData();
|
|
||||||
clearQuizData();
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container
|
<Container
|
||||||
component="nav"
|
component="nav"
|
||||||
@ -144,7 +125,12 @@ export const Header = ({ setMobileSidebar, scrollDown }: HeaderProps) => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<ToTariffsButton />
|
<ToTariffsButton />
|
||||||
<LogoutButton onClick={handleLogoutClick} />
|
<LogoutButton
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/");
|
||||||
|
handleLogoutClick();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -8,16 +8,11 @@ import {
|
|||||||
useTheme,
|
useTheme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
import Logotip from "../../pages/Landing/images/icons/QuizLogo";
|
||||||
import { clearAuthToken } from "@frontend/kitui";
|
|
||||||
import { logout } from "@api/auth";
|
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
import { enqueueSnackbar } from "notistack";
|
|
||||||
import { clearUserData } from "@root/user";
|
|
||||||
import { LogoutButton } from "@ui_kit/LogoutButton";
|
import { LogoutButton } from "@ui_kit/LogoutButton";
|
||||||
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
import { ToTariffsButton } from "@ui_kit/Toolbars/ToTariffsButton";
|
||||||
import ArrowLeft from "@icons/questionsPage/arrowLeft";
|
import ArrowLeft from "@icons/questionsPage/arrowLeft";
|
||||||
import { cleanAuthTicketData } from "@root/ticket";
|
import { handleLogoutClick } from "@utils/HandleLogoutClick";
|
||||||
import { clearQuizData } from "@root/quizes/store";
|
|
||||||
|
|
||||||
interface HeaderFullProps {
|
interface HeaderFullProps {
|
||||||
isRequest: boolean;
|
isRequest: boolean;
|
||||||
@ -30,20 +25,6 @@ export default function HeaderFull({ isRequest = false, sx }: HeaderFullProps) {
|
|||||||
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
const isTablet = useMediaQuery(theme.breakpoints.down(1000));
|
||||||
const isMobile = useMediaQuery(theme.breakpoints.down(500));
|
const isMobile = useMediaQuery(theme.breakpoints.down(500));
|
||||||
|
|
||||||
async function handleLogoutClick() {
|
|
||||||
const [, logoutError] = await logout();
|
|
||||||
|
|
||||||
if (logoutError) {
|
|
||||||
return enqueueSnackbar(logoutError);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanAuthTicketData();
|
|
||||||
clearAuthToken();
|
|
||||||
clearUserData();
|
|
||||||
clearQuizData();
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container
|
<Container
|
||||||
component="nav"
|
component="nav"
|
||||||
@ -73,7 +54,10 @@ export default function HeaderFull({ isRequest = false, sx }: HeaderFullProps) {
|
|||||||
<Box sx={{ display: "flex", ml: "auto" }}>
|
<Box sx={{ display: "flex", ml: "auto" }}>
|
||||||
<ToTariffsButton />
|
<ToTariffsButton />
|
||||||
<LogoutButton
|
<LogoutButton
|
||||||
onClick={handleLogoutClick}
|
onClick={() => {
|
||||||
|
navigate("/");
|
||||||
|
handleLogoutClick();
|
||||||
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
ml: "20px",
|
ml: "20px",
|
||||||
}}
|
}}
|
||||||
|
@ -19,15 +19,10 @@ import { Link, useLocation, useNavigate } from "react-router-dom";
|
|||||||
import { setCurrentStep, updateQuiz } from "@root/quizes/actions";
|
import { setCurrentStep, updateQuiz } from "@root/quizes/actions";
|
||||||
import { useCurrentQuiz } from "@root/quizes/hooks";
|
import { useCurrentQuiz } from "@root/quizes/hooks";
|
||||||
import { LogoutButton } from "@ui_kit/LogoutButton";
|
import { LogoutButton } from "@ui_kit/LogoutButton";
|
||||||
import { logout } from "@api/auth";
|
|
||||||
import { enqueueSnackbar } from "notistack";
|
|
||||||
import { clearAuthToken } from "@frontend/kitui";
|
|
||||||
import { clearUserData } from "@root/user";
|
|
||||||
import PencilCircleIcon from "@icons/PencilCircleIcon";
|
import PencilCircleIcon from "@icons/PencilCircleIcon";
|
||||||
import { quizSetupSteps } from "@model/quizSettings";
|
import { quizSetupSteps } from "@model/quizSettings";
|
||||||
import { updateNextStep } from "@root/uiTools/actions";
|
import { updateNextStep } from "@root/uiTools/actions";
|
||||||
import { cleanAuthTicketData } from "@root/ticket";
|
import { handleLogoutClick } from "@utils/HandleLogoutClick";
|
||||||
import { clearQuizData } from "@root/quizes/store";
|
|
||||||
|
|
||||||
interface SidebarIconProps {
|
interface SidebarIconProps {
|
||||||
height: string;
|
height: string;
|
||||||
@ -74,20 +69,6 @@ export const SidebarMobile: FC<Iprops> = ({
|
|||||||
setAnchorEl(anchorEl ? null : event.currentTarget);
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handleLogoutClick() {
|
|
||||||
const [, logoutError] = await logout();
|
|
||||||
|
|
||||||
if (logoutError) {
|
|
||||||
return enqueueSnackbar(logoutError);
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanAuthTicketData();
|
|
||||||
clearAuthToken();
|
|
||||||
clearUserData();
|
|
||||||
clearQuizData();
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
const clickInput = (event) => {
|
const clickInput = (event) => {
|
||||||
if (ref.current && !ref.current.contains(event.target)) setInputOpen(false);
|
if (ref.current && !ref.current.contains(event.target)) setInputOpen(false);
|
||||||
};
|
};
|
||||||
@ -223,7 +204,10 @@ export const SidebarMobile: FC<Iprops> = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LogoutButton
|
<LogoutButton
|
||||||
onClick={handleLogoutClick}
|
onClick={() => {
|
||||||
|
navigate("/");
|
||||||
|
handleLogoutClick();
|
||||||
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
border: "1px solid #9A9AAF",
|
border: "1px solid #9A9AAF",
|
||||||
|
13
src/utils/HandleLogoutClick.ts
Normal file
13
src/utils/HandleLogoutClick.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { cleanAuthTicketData } from "@root/ticket";
|
||||||
|
import { clearAuthToken } from "@frontend/kitui";
|
||||||
|
import { clearUserData } from "@root/user";
|
||||||
|
import { clearQuizData } from "@root/quizes/store";
|
||||||
|
import { logout } from "@api/auth";
|
||||||
|
|
||||||
|
export const handleLogoutClick = async () => {
|
||||||
|
cleanAuthTicketData();
|
||||||
|
clearAuthToken();
|
||||||
|
clearUserData();
|
||||||
|
clearQuizData();
|
||||||
|
const [, logoutError] = await logout();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user