demo account
parent
43b29282de
commit
c7f08d9733
|
@ -26,6 +26,7 @@ const StoreCalendarAuth = lazy(() => import("../../Pages/Store/Calendar/Auth"));
|
|||
//const Support = lazy(() => import("../../Pages/Support"));
|
||||
//const Feedback = lazy(() => import("../../Pages/Feedback"));
|
||||
const UserProfile = lazy(() => import("../../Pages/UserProfile"));
|
||||
const RedirectToDemo = lazy(() => import("../../Pages/RedirectToDemo"));
|
||||
|
||||
export function AuthenticationRoutes() {
|
||||
return (
|
||||
|
@ -84,6 +85,15 @@ export function AuthenticationRoutes() {
|
|||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path={Constants.ROUTE_PATHS.DEMO}
|
||||
element={
|
||||
<MySupsenseFallback>
|
||||
<RedirectToDemo />
|
||||
</MySupsenseFallback>
|
||||
}
|
||||
/>
|
||||
|
||||
<Route
|
||||
path="*"
|
||||
element={<Navigate to={Constants.ROUTE_PATHS.AUTHENTICATION.LOGIN} />}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import { useEffect } from "react";
|
||||
import MyCenteredSpin from "../../Components/MyCenteredSpin";
|
||||
import {
|
||||
myFetch,
|
||||
setUserSessionToLocalStorage,
|
||||
showUnkownErrorNotification,
|
||||
} from "../../utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { notification } from "antd";
|
||||
|
||||
export default function RedirectToDemo() {
|
||||
const { t } = useTranslation();
|
||||
const [notificationApi, notificationContextHolder] =
|
||||
notification.useNotification();
|
||||
|
||||
useEffect(() => {
|
||||
myFetch({
|
||||
url: "/user/demo",
|
||||
method: "GET",
|
||||
})
|
||||
.then((response) => {
|
||||
setUserSessionToLocalStorage(response.XAuthorization);
|
||||
window.location.href = "/";
|
||||
})
|
||||
.catch(() => showUnkownErrorNotification(notificationApi, t));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{notificationContextHolder}
|
||||
<MyCenteredSpin fullHeight />
|
||||
</>
|
||||
);
|
||||
}
|
|
@ -406,6 +406,7 @@ function YourProfileChangeEmailModal() {
|
|||
method: "POST",
|
||||
body: {
|
||||
email: values.email,
|
||||
password: EncodeStringToBase64(values.password),
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -421,7 +422,10 @@ function YourProfileChangeEmailModal() {
|
|||
),
|
||||
});
|
||||
})
|
||||
.catch(() => setIsRequesting(false));
|
||||
.catch(() => {
|
||||
setIsRequesting(false);
|
||||
showPasswordIncorrectNotification(notificationApi, t);
|
||||
});
|
||||
})
|
||||
.catch(() => setIsRequesting(false));
|
||||
}}
|
||||
|
@ -434,6 +438,8 @@ function YourProfileChangeEmailModal() {
|
|||
</Typography.Paragraph>
|
||||
|
||||
<MyEmailFormInput hasFeedback newEmail />
|
||||
|
||||
<MyPasswordFormInput />
|
||||
</Form>
|
||||
</MyModal>
|
||||
</>
|
||||
|
|
|
@ -66,6 +66,7 @@ export const Constants = {
|
|||
FEEDBACK: "/feedback",
|
||||
SUPPORT: "/support",
|
||||
USER_PROFILE: "/user-profile",
|
||||
DEMO: "/demo",
|
||||
},
|
||||
GLOBALS: {
|
||||
MIN_USERNAME_LENGTH: 3,
|
||||
|
|
Loading…
Reference in New Issue