frontend: useServers(), useOwners()
This commit is contained in:
parent
9eb9be7318
commit
43de7bc9b5
5 changed files with 70 additions and 61 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue