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 Support = lazy(() => import("../../Pages/Support"));
|
||||||
//const Feedback = lazy(() => import("../../Pages/Feedback"));
|
//const Feedback = lazy(() => import("../../Pages/Feedback"));
|
||||||
const UserProfile = lazy(() => import("../../Pages/UserProfile"));
|
const UserProfile = lazy(() => import("../../Pages/UserProfile"));
|
||||||
|
const RedirectToDemo = lazy(() => import("../../Pages/RedirectToDemo"));
|
||||||
|
|
||||||
export function AuthenticationRoutes() {
|
export function AuthenticationRoutes() {
|
||||||
return (
|
return (
|
||||||
|
@ -84,6 +85,15 @@ export function AuthenticationRoutes() {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Route
|
||||||
|
path={Constants.ROUTE_PATHS.DEMO}
|
||||||
|
element={
|
||||||
|
<MySupsenseFallback>
|
||||||
|
<RedirectToDemo />
|
||||||
|
</MySupsenseFallback>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
path="*"
|
path="*"
|
||||||
element={<Navigate to={Constants.ROUTE_PATHS.AUTHENTICATION.LOGIN} />}
|
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",
|
method: "POST",
|
||||||
body: {
|
body: {
|
||||||
email: values.email,
|
email: values.email,
|
||||||
|
password: EncodeStringToBase64(values.password),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -421,7 +422,10 @@ function YourProfileChangeEmailModal() {
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => setIsRequesting(false));
|
.catch(() => {
|
||||||
|
setIsRequesting(false);
|
||||||
|
showPasswordIncorrectNotification(notificationApi, t);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(() => setIsRequesting(false));
|
.catch(() => setIsRequesting(false));
|
||||||
}}
|
}}
|
||||||
|
@ -434,6 +438,8 @@ function YourProfileChangeEmailModal() {
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
|
|
||||||
<MyEmailFormInput hasFeedback newEmail />
|
<MyEmailFormInput hasFeedback newEmail />
|
||||||
|
|
||||||
|
<MyPasswordFormInput />
|
||||||
</Form>
|
</Form>
|
||||||
</MyModal>
|
</MyModal>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -66,6 +66,7 @@ export const Constants = {
|
||||||
FEEDBACK: "/feedback",
|
FEEDBACK: "/feedback",
|
||||||
SUPPORT: "/support",
|
SUPPORT: "/support",
|
||||||
USER_PROFILE: "/user-profile",
|
USER_PROFILE: "/user-profile",
|
||||||
|
DEMO: "/demo",
|
||||||
},
|
},
|
||||||
GLOBALS: {
|
GLOBALS: {
|
||||||
MIN_USERNAME_LENGTH: 3,
|
MIN_USERNAME_LENGTH: 3,
|
||||||
|
|
Loading…
Reference in New Issue