getRedirectUrl.ts 469 B

12345678910111213141516
  1. import { useGlobSetting } from '@/hooks/setting';
  2. import urlJoin from 'url-join';
  3. const { loginApp } = useGlobSetting();
  4. export const getRedirectUrl = () => {
  5. const encodeUrl = encodeURIComponent(window.location.href);
  6. return loginApp + '?redirect=' + encodeUrl;
  7. };
  8. export const getLogoutUrl = () => {
  9. if (!loginApp) return '';
  10. const encodeUrl = encodeURIComponent(window.location.href);
  11. return loginApp + `logout?redirect=${encodeUrl}`;
  12. };