Skip to content

Commit

Permalink
fix(Callback): change setLocation path
Browse files Browse the repository at this point in the history
  • Loading branch information
ifokeev committed Feb 16, 2024
1 parent 2fecf11 commit dcedb67
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pages/Callback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Result } from "antd";
import { useTranslation } from "react-i18next";

import { EXPLORE, SIGNIN } from "@/utils/constants/paths";
import { EXPLORE } from "@/utils/constants/paths";
import BasicLayout from "@/layouts/BasicLayout";
import AuthTokensStore from "@/stores/AuthTokensStore";
import Button from "@/components/Button";
Expand All @@ -13,7 +13,7 @@ import s from "./index.module.less";
const Callback: React.FC = () => {
const { t } = useTranslation(["callback"]);
const [error, setError] = useState<boolean>(false);
const { setAuthData } = AuthTokensStore();
const { setAuthData, cleanTokens } = AuthTokensStore();
const [location, setLocation] = useLocation();
const { refresh_token } = location.query;

Expand All @@ -23,6 +23,7 @@ const Callback: React.FC = () => {
if (result.error) {
setError(true);
} else {
cleanTokens();
setAuthData({
accessToken: result.jwt_token,
refreshToken: result.refresh_token,
Expand All @@ -43,7 +44,11 @@ const Callback: React.FC = () => {
title={error ? t("error.title") : t("title")}
subTitle={error ? t("error.subtitle") : t("subtitle")}
extra={[
<Button type="primary" key="back" onClick={() => setLocation(SIGNIN)}>
<Button
type="primary"
key="back"
onClick={() => setLocation(EXPLORE)}
>
{t("action")}
</Button>,
]}
Expand Down

0 comments on commit dcedb67

Please sign in to comment.