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