feat(fc2b): ml / allowlist / aliases Pinia stores
Thin wrappers over the FC-2b API: ml (settings GET/PATCH, backfill + recompute triggers), allowlist (list, threshold patch, remove with optimistic local update), aliases (list, remove with optimistic update). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { useApi } from '../composables/useApi.js'
|
||||
|
||||
export const useAliasesStore = defineStore('aliases', () => {
|
||||
const api = useApi()
|
||||
const rows = ref([])
|
||||
const loading = ref(false)
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try { rows.value = await api.get('/api/aliases') }
|
||||
finally { loading.value = false }
|
||||
}
|
||||
|
||||
async function remove(aliasString, aliasCategory) {
|
||||
await api.delete(
|
||||
`/api/aliases/${encodeURIComponent(aliasString)}/${encodeURIComponent(aliasCategory)}`
|
||||
)
|
||||
rows.value = rows.value.filter(
|
||||
r => !(r.alias_string === aliasString && r.alias_category === aliasCategory)
|
||||
)
|
||||
}
|
||||
|
||||
return { rows, loading, load, remove }
|
||||
})
|
||||
Reference in New Issue
Block a user