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

Merge branch 'main' of gitcode.com:git_bot/ai-fe

......@@ -41,7 +41,9 @@
<UButton
size="md"
label="创建"
:loading="loading"
:disabled="!title"
@click="handleCreate"
/>
</div>
</template>
......@@ -50,13 +52,23 @@
</template>
<script setup>
const { $isLibraryCreateOpen } = storeToRefs(useLibraryStore())
const { $openLibraryCreate, $closeLibraryCreate } = useLibraryStore()
const { $closeLibraryCreate } = useLibraryStore()
const { setOrUpdateFavorites } = useFavorites()
const title = ref('')
const description = ref('')
const loading = ref(false)
function handleClose () {
$closeLibraryCreate()
}
function handleOpen () {
$openLibraryCreate
async function handleCreate () {
if (loading.value) return
loading.value = true
const { data, error } = await setOrUpdateFavorites({
name: title.value,
description: description.value
})
loading.value = false
if (error.value) return
$closeLibraryCreate()
}
</script>
export default () => {
// 创建及修改收藏夹
const setAndUpdateFavorites = (body) => {
const setOrUpdateFavorites = async (body) => {
/*
* id number 非必须 有ID参数是修改,没有ID则为新增
* name string 非必须
......@@ -66,7 +66,7 @@ export default () => {
}
return {
getFavorites,
setAndUpdateFavorites,
setOrUpdateFavorites,
deleteFavorite,
saveFavorite,
findFavorite,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册