direct redirecting
parent
5ba900afb3
commit
bcc323028c
|
@ -230,12 +230,6 @@
|
||||||
},
|
},
|
||||||
"calendar": {
|
"calendar": {
|
||||||
"pageTitle": "Kalender",
|
"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": {
|
"authFailed": {
|
||||||
"title": "Verbindung fehlgeschlagen",
|
"title": "Verbindung fehlgeschlagen",
|
||||||
"description": "Die Verbindung mit Ihrem Google-Kalender ist fehlgeschlagen.",
|
"description": "Die Verbindung mit Ihrem Google-Kalender ist fehlgeschlagen.",
|
||||||
|
|
|
@ -233,12 +233,6 @@
|
||||||
},
|
},
|
||||||
"calendar": {
|
"calendar": {
|
||||||
"pageTitle": "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": {
|
"authFailed": {
|
||||||
"title": "Connection failed",
|
"title": "Connection failed",
|
||||||
"description": "Connection to your calendar failed.",
|
"description": "Connection to your calendar failed.",
|
||||||
|
|
|
@ -181,14 +181,3 @@ export function AppRoutes({ setUserSession }) {
|
||||||
</Routes>
|
</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 { Link, useParams, useNavigate } from "react-router-dom";
|
||||||
import { Constants, myFetch } from "../../../../utils";
|
import { Constants, myFetch } from "../../../../utils";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
@ -9,6 +9,7 @@ export default function StoreCalendarAuth() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [notificationApi, notificationContextHolder] =
|
const [notificationApi, notificationContextHolder] =
|
||||||
notification.useNotification();
|
notification.useNotification();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { status } = useParams();
|
const { status } = useParams();
|
||||||
|
|
||||||
|
@ -23,6 +24,13 @@ export default function StoreCalendarAuth() {
|
||||||
t: t,
|
t: t,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (status === "finish") {
|
||||||
|
navigate(
|
||||||
|
`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${res.storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsRequesting(false);
|
setIsRequesting(false);
|
||||||
setStoreId(res.storeId);
|
setStoreId(res.storeId);
|
||||||
})
|
})
|
||||||
|
@ -44,59 +52,19 @@ export default function StoreCalendarAuth() {
|
||||||
{notificationContextHolder}
|
{notificationContextHolder}
|
||||||
|
|
||||||
<Result
|
<Result
|
||||||
status={status === "finish" ? "success" : "error"}
|
status={"error"}
|
||||||
title={
|
title={t("calendar.authFailed.title")}
|
||||||
status === "finish"
|
subTitle={t("calendar.authFailed.description")}
|
||||||
? t("calendar.authFinish.title")
|
|
||||||
: t("calendar.authFailed.title")
|
|
||||||
}
|
|
||||||
subTitle={
|
|
||||||
status === "finish"
|
|
||||||
? t("calendar.authFinish.description")
|
|
||||||
: t("calendar.authFailed.description")
|
|
||||||
}
|
|
||||||
extra={[
|
extra={[
|
||||||
<Flex key="1" vertical>
|
<Flex key="1" vertical>
|
||||||
<Link
|
<Link
|
||||||
to={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`}
|
to={`${Constants.ROUTE_PATHS.STORE.OVERVIEW}/${storeId}/${Constants.ROUTE_PATHS.STORE.CALENDAR}`}
|
||||||
>
|
>
|
||||||
<Button>
|
<Button>{t("calendar.authFailed.button")}</Button>
|
||||||
{status === "finish"
|
|
||||||
? t("calendar.authFinish.button")
|
|
||||||
: t("calendar.authFailed.button")}
|
|
||||||
</Button>
|
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{status === "finish" && <CountdownRedirect storeId={storeId} />}
|
|
||||||
</Flex>,
|
</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