diff --git a/components/i/Create.vue b/components/i/Create.vue index 8de5287ce9ffe4dc5dfc7bf859a0aca1bcce0084..da1c647992ff8a988a6dd11abf13e98a07cef0cb 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: {