ForcePilot/web/src/stores/database.js

18 lines
482 B
JavaScript
Raw Normal View History

import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
2025-07-22 17:29:38 +08:00
import { databaseApi } from '@/apis/knowledge_api'
export const useDatabaseStore = defineStore('database', () => {
const db = ref({})
function setDatabase(newDatabase) {
db.value = newDatabase
}
async function refreshDatabase() {
2025-07-22 17:29:38 +08:00
const res = await databaseApi.getDatabases()
console.log("database", res)
setDatabase(res.databases)
2024-10-24 13:09:59 +08:00
}
return { db, setDatabase, refreshDatabase }
})