frontend: useServers(), useOwners()

This commit is contained in:
Frank Agerholm 2026-01-25 19:55:55 +01:00
commit 43de7bc9b5
No known key found for this signature in database
5 changed files with 70 additions and 61 deletions

View file

@ -9,28 +9,12 @@ import { ref, onMounted } from "vue"
const { loadToken } = useAuth()
const { apiFetch } = useApi()
const { owners, loadOwners } = useOwners()
const owners = ref([])
const newOwnerName = ref("")
const loading = ref(false)
const error = ref("")
async function loadOwners() {
loading.value = true
try {
const result = await apiFetch("/owners")
if (isUnauthorized(result)) {
return result
}
owners.value = result
return result
} catch (e: any) {
error.value = e.message
} finally {
loading.value = false
}
}
async function createOwner() {
if (!newOwnerName.value.trim()) return