import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { applyDefaultWechatShare } from '../lib/wechat-share';

/** 路由变化时刷新微信右上角分享卡片 */
export default function WechatShareBootstrap() {
  const location = useLocation();

  useEffect(() => {
    void applyDefaultWechatShare().catch(() => {});
  }, [location.pathname, location.search]);

  return null;
}
