diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index da0173f943ff0123b68ddfc7f68eeb333df72143..b9e2158f24f5e5192cf28f7a2c3e562857c3f4b5 100644 --- a/components/i/search/Header.vue +++ b/components/i/search/Header.vue @@ -92,20 +92,20 @@ function handleBlurTitle () { isEditTitle.value = false emits('update-query', editTitle.value) } -async function handleShare () { +function handleShare (isUpdate) { const shareType = String(isOpen.value) - const { error } = await useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) - if (!error.value && isOpen.value) { - useCopyToClipboard().copy(window.location.href) - toast.add({ - icon: 'i-heroicons-information-circle-20-solid', - timeout: 2000, - title: '链接已复制到剪贴板' - }) - } + useCopyToClipboard().copy(window.location.href) + toast.add({ + icon: 'i-heroicons-information-circle-20-solid', + timeout: 2000, + title: '链接已复制到剪贴板' + }) + isUpdate && useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) + } function handleUpdateOpenState (state) { + const updateOpened = isOpen.value !== state isOpen.value = state - handleShare() + handleShare(updateOpened) } \ No newline at end of file