Merge branch 'dev' into 'staging'
fix rules of hooks violation See merge request frontend/squiz!340
This commit is contained in:
commit
5c9b0ecc0a
99
src/App.tsx
99
src/App.tsx
@ -4,30 +4,13 @@ import { lazily } from "react-lazily";
|
||||
import ContactFormModal from "@ui_kit/ContactForm";
|
||||
import SigninDialog from "./pages/auth/Signin";
|
||||
import SignupDialog from "./pages/auth/Signup";
|
||||
import {
|
||||
Navigate,
|
||||
Route,
|
||||
Routes,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from "react-router-dom";
|
||||
import { Navigate, Route, Routes, useLocation, useNavigate } from "react-router-dom";
|
||||
import "./index.css";
|
||||
import Landing from "./pages/Landing/Landing";
|
||||
import Main from "./pages/main";
|
||||
import {
|
||||
clearAuthToken,
|
||||
getMessageFromFetchError,
|
||||
UserAccount,
|
||||
useUserFetcher,
|
||||
} from "@frontend/kitui";
|
||||
import { clearAuthToken, getMessageFromFetchError, UserAccount, useUserFetcher } from "@frontend/kitui";
|
||||
import type { OriginalUserAccount } from "@root/user";
|
||||
import {
|
||||
clearUserData,
|
||||
setCustomerAccount,
|
||||
setUser,
|
||||
setUserAccount,
|
||||
useUserStore,
|
||||
} from "@root/user";
|
||||
import { clearUserData, setCustomerAccount, setUser, setUserAccount, useUserStore } from "@root/user";
|
||||
import { enqueueSnackbar } from "notistack";
|
||||
import PrivateRoute from "@ui_kit/PrivateRoute";
|
||||
import FloatingSupportChat from "@ui_kit/FloatingSupportChat";
|
||||
@ -50,15 +33,9 @@ const Analytics = lazy(() => import("./pages/Analytics/Analytics"));
|
||||
const EditPage = lazy(() => import("./pages/startPage/EditPage"));
|
||||
const { Tariffs } = lazily(() => import("./pages/Tariffs/Tariffs"));
|
||||
const { DesignPage } = lazily(() => import("./pages/DesignPage/DesignPage"));
|
||||
const { IntegrationsPage } = lazily(
|
||||
() => import("./pages/IntegrationsPage/IntegrationsPage"),
|
||||
);
|
||||
const { QuizAnswersPage } = lazily(
|
||||
() => import("./pages/QuizAnswersPage/QuizAnswersPage"),
|
||||
);
|
||||
const ChatImageNewWindow = lazy(
|
||||
() => import("@ui_kit/FloatingSupportChat/ChatImageNewWindow"),
|
||||
);
|
||||
const { IntegrationsPage } = lazily(() => import("./pages/IntegrationsPage/IntegrationsPage"));
|
||||
const { QuizAnswersPage } = lazily(() => import("./pages/QuizAnswersPage/QuizAnswersPage"));
|
||||
const ChatImageNewWindow = lazy(() => import("@ui_kit/FloatingSupportChat/ChatImageNewWindow"));
|
||||
|
||||
const routeslink = [
|
||||
{
|
||||
@ -137,6 +114,8 @@ export default function App() {
|
||||
},
|
||||
});
|
||||
|
||||
useAfterpay();
|
||||
|
||||
if (location.state?.redirectTo)
|
||||
return (
|
||||
<Navigate
|
||||
@ -146,39 +125,67 @@ export default function App() {
|
||||
/>
|
||||
);
|
||||
|
||||
useAfterpay();
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContactFormModal />
|
||||
<FloatingSupportChat />
|
||||
{location.state?.backgroundLocation && (
|
||||
<Routes>
|
||||
<Route path="/signin" element={<SigninDialog />} />
|
||||
<Route path="/signup" element={<SignupDialog />} />
|
||||
<Route path="/recover" element={<Restore />} />
|
||||
<Route path="/changepwd" element={<RecoverPassword />} />
|
||||
<Route path="/changepwd/expired" element={<OutdatedLink />} />
|
||||
<Route
|
||||
path="/signin"
|
||||
element={<SigninDialog />}
|
||||
/>
|
||||
<Route
|
||||
path="/signup"
|
||||
element={<SignupDialog />}
|
||||
/>
|
||||
<Route
|
||||
path="/recover"
|
||||
element={<Restore />}
|
||||
/>
|
||||
<Route
|
||||
path="/changepwd"
|
||||
element={<RecoverPassword />}
|
||||
/>
|
||||
<Route
|
||||
path="/changepwd/expired"
|
||||
element={<OutdatedLink />}
|
||||
/>
|
||||
</Routes>
|
||||
)}
|
||||
<Routes location={location.state?.backgroundLocation || location}>
|
||||
<Route path="/" element={<Landing />} />
|
||||
<Route
|
||||
path="/"
|
||||
element={<Landing />}
|
||||
/>
|
||||
<Route
|
||||
path="/signin"
|
||||
element={
|
||||
<Navigate to="/" replace state={{ redirectTo: "/signin" }} />
|
||||
<Navigate
|
||||
to="/"
|
||||
replace
|
||||
state={{ redirectTo: "/signin" }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/signup"
|
||||
element={
|
||||
<Navigate to="/" replace state={{ redirectTo: "/signup" }} />
|
||||
<Navigate
|
||||
to="/"
|
||||
replace
|
||||
state={{ redirectTo: "/signup" }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/recover"
|
||||
element={
|
||||
<Navigate to="/" replace state={{ redirectTo: "/recover" }} />
|
||||
<Navigate
|
||||
to="/"
|
||||
replace
|
||||
state={{ redirectTo: "/recover" }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
@ -209,7 +216,12 @@ export default function App() {
|
||||
/>
|
||||
<Route
|
||||
path="/list"
|
||||
element={<LazyLoading children={<MyQuizzesFull />} fallback={<ListPageDummy/>} />}
|
||||
element={
|
||||
<LazyLoading
|
||||
children={<MyQuizzesFull />}
|
||||
fallback={<ListPageDummy />}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path={"/view/:quizId"}
|
||||
@ -231,7 +243,10 @@ export default function App() {
|
||||
path={"/qaz"}
|
||||
element={<LazyLoading children={<InfoPrivilege />} />}
|
||||
/>
|
||||
<Route path={"/image/:srcImage"} element={<ChatImageNewWindow />} />
|
||||
<Route
|
||||
path={"/image/:srcImage"}
|
||||
element={<ChatImageNewWindow />}
|
||||
/>
|
||||
<Route element={<PrivateRoute />}>
|
||||
{routeslink.map((e, i) => (
|
||||
<Route
|
||||
|
Loading…
Reference in New Issue
Block a user