mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
25 lines
597 B
TypeScript
25 lines
597 B
TypeScript
import * as React from "react";
|
|
import { Redirect } from "react-router-dom";
|
|
import env from "~/env";
|
|
import useStores from "~/hooks/useStores";
|
|
import { logoutPath } from "~/utils/routeHelpers";
|
|
|
|
const Logout = () => {
|
|
const { auth } = useStores();
|
|
|
|
void auth.logout().then(() => {
|
|
if (env.OIDC_LOGOUT_URI) {
|
|
setTimeout(() => {
|
|
window.location.replace(env.OIDC_LOGOUT_URI);
|
|
}, 200);
|
|
}
|
|
});
|
|
|
|
if (env.OIDC_LOGOUT_URI) {
|
|
return null; // user will be redirected to logout URI after logout
|
|
}
|
|
return <Redirect to={logoutPath()} />;
|
|
};
|
|
|
|
export default Logout;
|