Files
outline/app/scenes/Logout.tsx
Boris Bliznioukov 20799c941e logout for OIDC #6909 (#7446)
* logout for OIDC

* logout fix

* add some time
2024-09-01 07:11:45 -07:00

24 lines
535 B
TypeScript

import * as React from "react";
import { Redirect } from "react-router-dom";
import env from "~/env";
import useStores from "~/hooks/useStores";
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="/" />;
};
export default Logout;