From f6a01f8a02fdc4ae4ada55279f84b0bfc5dd7b16 Mon Sep 17 00:00:00 2001 From: Aresn Date: Thu, 23 May 2024 12:01:36 +0800 Subject: [PATCH] Update Create.vue --- components/i/Create.vue | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/components/i/Create.vue b/components/i/Create.vue index 8de5287..da1c647 100644 --- a/components/i/Create.vue +++ b/components/i/Create.vue @@ -54,22 +54,23 @@ const handleSearch = async () => { }) } } - -if (!$repos.length) { - let repoData = await fetchRequest('/v1/chat/repository', { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - } - }) - repoData = repoData.data.map(item => { - return { - label: item.name, - url: item.path, - branch: item.branch - } - }) - $setRepo(repoData) -} +onMounted(async () => { + if (!$repos.length) { + let repoData = await fetchRequest('/v1/chat/repository', { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + } + }) + repoData = repoData.data.map(item => { + return { + label: item.name, + url: item.path, + branch: item.branch + } + }) + $setRepo(repoData) + } +}) defineShortcuts({ meta_enter: { -- GitLab