user.tsx 990 B

12345678910111213141516171819202122232425262728293031323334
  1. "use client";
  2. import React, {
  3. useState,
  4. useRef,
  5. useEffect,
  6. useMemo,
  7. useCallback,
  8. Fragment,
  9. RefObject,
  10. } from "react";
  11. import { UserSwitchOutlined } from '@ant-design/icons';
  12. import { Modal } from "antd";
  13. import {replaceUrl} from '@/app/utils/index'
  14. export function UserOut(props: { globalStore: any; chatStore: any }) {
  15. const {globalStore,chatStore} = props;
  16. return <UserSwitchOutlined className="cursor-pointer" onClick={() => {
  17. Modal.confirm({
  18. title: '确认退出当前用户吗?',
  19. onOk() {
  20. localStorage.clear();
  21. window.sessionStorage.clear();
  22. // globalStore.setSelectedAppId('1881234567890');
  23. globalStore.setSelectedAppId('');
  24. chatStore.clearSessions();
  25. window.location.replace(`${replaceUrl}?redirectUrl=${encodeURIComponent(window.location.href)}`);
  26. // const originUrl = window.location.origin;
  27. // window.open(originUrl + '/#/login', '_self');
  28. },
  29. });
  30. }} />
  31. }