From 6ebddb4426c36256d669ffd46e3d081a5baada4f Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Tue, 28 May 2024 13:53:48 +0800 Subject: [PATCH] Update Header.vue --- components/i/search/Header.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index da0173f..b9e2158 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 -- GitLab