import { useGlobSetting } from '@/hooks/setting';
import urlJoin from 'url-join';

const { loginApp } = useGlobSetting();

export const getRedirectUrl = () => {
  const encodeUrl = encodeURIComponent(window.location.href);
  return loginApp + '?redirect=' + encodeUrl;
};

export const getLogoutUrl = () => {
  if (!loginApp) return '';
  const encodeUrl = encodeURIComponent(location.pathname);
  return loginApp + `logout?redirect=${encodeUrl}`;
};
