make logout redirect a env var

This commit is contained in:
Philipp Rothmann 2022-11-02 11:53:42 +01:00
parent 2185629c6e
commit 3ba032153e
3 changed files with 7 additions and 7 deletions

1
public/env.js vendored
View file

@ -1,3 +1,4 @@
window.env = { window.env = {
REACT_APP_API_URL: 'http://localhost:5000/api/v1', REACT_APP_API_URL: 'http://localhost:5000/api/v1',
REACT_APP_SSO_LOGOUT_URL: 'https://login.example.org/if/flow/default-invalidation-flow/'
}; };

View file

@ -10,7 +10,8 @@ import _ from 'lodash';
import { UserModal } from '../UserModal'; import { UserModal } from '../UserModal';
const HYDRA_LOGOUT_URL = `${process.env.REACT_APP_HYDRA_PUBLIC_URL}/oauth2/sessions/logout`; // @ts-ignore
const HYDRA_LOGOUT_URL = window.env.REACT_APP_SSO_LOGOUT_URL;
const navigation = [ const navigation = [
{ name: 'Dashboard', to: '/dashboard', requiresAdmin: false }, { name: 'Dashboard', to: '/dashboard', requiresAdmin: false },
@ -56,10 +57,7 @@ const HeaderLIT: React.FC<HeaderProps> = () => {
const signOutUrl = useMemo(() => { const signOutUrl = useMemo(() => {
const { hostname } = window.location; const { hostname } = window.location;
// If we are developing locally, we need to use the init cluster's public URL // If we are developing locally, we need to use the init cluster's public URL
if (hostname === 'localhost') {
return HYDRA_LOGOUT_URL; return HYDRA_LOGOUT_URL;
}
return `https://${hostname.replace(/^dashboard/, 'sso')}/oauth2/sessions/logout`;
}, []); }, []);
return ( return (

View file

@ -1,4 +1,5 @@
import { createApiAction } from 'src/services/api'; import axios from 'axios';
import { createApiAction, createApiCall, performApiCall } from 'src/services/api';
import { SuccessAction } from 'src/services/api/redux/types'; import { SuccessAction } from 'src/services/api/redux/types';
export enum AuthActionTypes { export enum AuthActionTypes {
@ -26,7 +27,7 @@ export const signIn = (params: string) =>
); );
export function signOut() { export function signOut() {
return (dispatch: any) => { return async (dispatch: any) => {
dispatch(signOutAction()); dispatch(signOutAction());
}; };
} }