提交 c17df9c5 编写于 作者: View Design's avatar View Design

update

上级 8c48fffb
...@@ -55,19 +55,21 @@ const handleSearch = async () => { ...@@ -55,19 +55,21 @@ const handleSearch = async () => {
} }
} }
let repoData = await fetchRequest('/v1/chat/repository', { if (!$repos.length) {
headers: { let repoData = await fetchRequest('/v1/chat/repository', {
'Content-Type': 'application/x-www-form-urlencoded' headers: {
} 'Content-Type': 'application/x-www-form-urlencoded'
}) }
repoData = repoData.data.map(item => { })
return { repoData = repoData.data.map(item => {
label: item.name, return {
url: item.path, label: item.name,
branch: item.branch url: item.path,
} branch: item.branch
}) }
$setRepo(repoData) })
$setRepo(repoData)
}
defineShortcuts({ defineShortcuts({
meta_enter: { meta_enter: {
......
...@@ -42,19 +42,22 @@ const { fetchRequest } = useFetchRequest() ...@@ -42,19 +42,22 @@ const { fetchRequest } = useFetchRequest()
const editIndex = ref(0) const editIndex = ref(0)
const { y } = useWindowScroll({ behavior: 'smooth' }) const { y } = useWindowScroll({ behavior: 'smooth' })
const { directions } = useScroll(window) const { directions } = useScroll(window)
let repoData = await fetchRequest('/v1/chat/repository', {
headers: { if (!$repos.length) {
'Content-Type': 'application/x-www-form-urlencoded' let repoData = await fetchRequest('/v1/chat/repository', {
} headers: {
}).catch(()=> {}) 'Content-Type': 'application/x-www-form-urlencoded'
repoData = repoData && repoData.data.map(item => { }
return { }).catch(()=> {})
label: item.name, repoData = repoData && repoData.data.map(item => {
url: item.path, return {
branch: item.branch label: item.name,
} url: item.path,
}) branch: item.branch
$setRepo(repoData) }
})
$setRepo(repoData)
}
// todo mock // todo mock
const repoItem = $repos.find(item => route.query.repo === item.label) || {} const repoItem = $repos.find(item => route.query.repo === item.label) || {}
const state = reactive({ const state = reactive({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册