Files
pole-book/server/node_modules/.strapi/vite/deps/AuthResponse-PZJFFLGR.js

86 lines
2.1 KiB
JavaScript

import {
Page
} from "./chunk-5CAWUBTQ.js";
import {
login
} from "./chunk-W2TBR6J3.js";
import {
useTypedDispatch
} from "./chunk-QEGMJR7H.js";
import {
getCookieValue
} from "./chunk-LCL5TIBZ.js";
import "./chunk-WOQNBAGN.js";
import "./chunk-BHLYCXQ7.js";
import "./chunk-76QM3EFM.js";
import "./chunk-CE4VABH2.js";
import "./chunk-5VODLFKF.js";
import "./chunk-N55RVBRV.js";
import {
useIntl
} from "./chunk-7XB6XSWQ.js";
import {
useMatch,
useNavigate
} from "./chunk-TUXTO2Z5.js";
import "./chunk-FOD4ENRR.js";
import "./chunk-WRD5KPDH.js";
import {
require_jsx_runtime
} from "./chunk-NIAJZ5MX.js";
import "./chunk-ACIMPXWY.js";
import {
require_react
} from "./chunk-MADUDGYZ.js";
import {
__toESM
} from "./chunk-PLDDJCW6.js";
// node_modules/@strapi/admin/dist/admin/ee/admin/src/pages/AuthResponse.mjs
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
var React = __toESM(require_react(), 1);
var AuthResponse = () => {
const match = useMatch("/auth/login/:authResponse");
const { formatMessage } = useIntl();
const navigate = useNavigate();
const dispatch = useTypedDispatch();
const redirectToOops = React.useCallback(() => {
navigate({
pathname: "/auth/oops",
search: `?info=${encodeURIComponent(formatMessage({
id: "Auth.form.button.login.providers.error",
defaultMessage: "We cannot connect you through the selected provider."
}))}`
});
}, [
navigate,
formatMessage
]);
React.useEffect(() => {
if ((match == null ? void 0 : match.params.authResponse) === "error") {
redirectToOops();
}
if ((match == null ? void 0 : match.params.authResponse) === "success") {
const jwtToken = getCookieValue("jwtToken");
if (jwtToken) {
dispatch(login({
token: jwtToken
}));
navigate("/auth/login");
} else {
redirectToOops();
}
}
}, [
dispatch,
match,
redirectToOops,
navigate
]);
return (0, import_jsx_runtime.jsx)(Page.Loading, {});
};
export {
AuthResponse
};
//# sourceMappingURL=AuthResponse-PZJFFLGR.js.map