direct redirecting
parent
5ba900afb3
commit
bcc323028c
|
@ -230,12 +230,6 @@
|
|||
},
|
||||
"calendar": {
|
||||
"pageTitle": "Kalender",
|
||||
"authFinish": {
|
||||
"title": "Erfolgreich verbunden",
|
||||
"description": "Die Verbindung mit Ihrem Google-Kalender war erfolgreich.",
|
||||
"button": "Weiter zum Kalender",
|
||||
"countDownRedirect": "Sie werden in {{countDown}} Sekunden weitergeleitet."
|
||||
},
|
||||
"authFailed": {
|
||||
"title": "Verbindung fehlgeschlagen",
|
||||
"description": "Die Verbindung mit Ihrem Google-Kalender ist fehlgeschlagen.",
|
||||
|
|
|
@ -233,12 +233,6 @@
|
|||
},
|
||||
"calendar": {
|
||||
"pageTitle": "Calendar",
|
||||
"authFinish": {
|
||||
"title": "Connection successful",
|
||||
"description": "Connection to your calendar was successful.",
|
||||
"button": "Continue to calendar",
|
||||
"countDownRedirect": "Redirecting to calendar in {{countDown}} seconds"
|
||||
},
|
||||
"authFailed": {
|
||||
"title": "Connection failed",
|
||||
"description": "Connection to your calendar failed.",
|
||||
|
|
|
@ -181,14 +181,3 @@ export function AppRoutes({ setUserSession }) {
|
|||
</Routes>
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
<Route
|
||||
path={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/:storeId/${Constants.ROUTE_PATHS.STORE.WEBSITE}`}
|
||||
element={
|
||||
<MySupsenseFallback>
|
||||
<StoreWebsite />
|
||||
</MySupsenseFallback>
|
||||
}
|
||||
/>
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Button, Flex, Result, Spin, Typography, notification } from "antd";
|
||||
import { Button, Flex, Result, Spin, notification } from "antd";
|
||||
import { Link, useParams, useNavigate } from "react-router-dom";
|
||||
import { Constants, myFetch } from "../../../../utils";
|
||||
import { useEffect, useState } from "react";
|
||||
|
@ -9,6 +9,7 @@ export default function StoreCalendarAuth() {
|
|||
const { t } = useTranslation();
|
||||
const [notificationApi, notificationContextHolder] =
|
||||
notification.useNotification();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { status } = useParams();
|
||||
|
||||
|
@ -23,6 +24,13 @@ export default function StoreCalendarAuth() {
|
|||
t: t,
|
||||
})
|
||||
.then((res) => {
|
||||
if (status === "finish") {
|
||||
navigate(
|
||||
`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${res.storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setIsRequesting(false);
|
||||
setStoreId(res.storeId);
|
||||
})
|
||||
|
@ -44,59 +52,19 @@ export default function StoreCalendarAuth() {
|
|||
{notificationContextHolder}
|
||||
|
||||
<Result
|
||||
status={status === "finish" ? "success" : "error"}
|
||||
title={
|
||||
status === "finish"
|
||||
? t("calendar.authFinish.title")
|
||||
: t("calendar.authFailed.title")
|
||||
}
|
||||
subTitle={
|
||||
status === "finish"
|
||||
? t("calendar.authFinish.description")
|
||||
: t("calendar.authFailed.description")
|
||||
}
|
||||
status={"error"}
|
||||
title={t("calendar.authFailed.title")}
|
||||
subTitle={t("calendar.authFailed.description")}
|
||||
extra={[
|
||||
<Flex key="1" vertical>
|
||||
<Link
|
||||
to={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`}
|
||||
>
|
||||
<Button>
|
||||
{status === "finish"
|
||||
? t("calendar.authFinish.button")
|
||||
: t("calendar.authFailed.button")}
|
||||
</Button>
|
||||
<Button>{t("calendar.authFailed.button")}</Button>
|
||||
</Link>
|
||||
|
||||
{status === "finish" && <CountdownRedirect storeId={storeId} />}
|
||||
</Flex>,
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function CountdownRedirect({ storeId }) {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [count, setCount] = useState(5);
|
||||
|
||||
useEffect(() => {
|
||||
if (count > 0) {
|
||||
const timer = setTimeout(() => {
|
||||
setCount(count - 1);
|
||||
}, 1000);
|
||||
return () => clearTimeout(timer);
|
||||
} else {
|
||||
navigate(
|
||||
`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`
|
||||
);
|
||||
}
|
||||
}, [count, navigate]);
|
||||
|
||||
return (
|
||||
<Typography.Text type="secondary" style={{ paddingTop: 10 }}>
|
||||
{t("calendar.authFinish.countDownRedirect", { countDown: count })}
|
||||
</Typography.Text>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue