import { XMessage } from '@/hooks'

export const copy = async (content?: string | null) => {
  if (!content) {
    XMessage.error('无可复制的内容')
    return
  }
  try {
    await navigator.clipboard.writeText(content)
    XMessage.success('复制成功')
  } catch (error) {
    XMessage.error('复制失败')
  }
}
