mirror of
https://github.com/jpros/tacticalrmm-web.git
synced 2026-02-21 03:41:21 +00:00
24 lines
502 B
JavaScript
24 lines
502 B
JavaScript
|
|
import { ref } from "vue"
|
|
import { fetchAgents } from "@/api/agents"
|
|
import { formatAgentOptions } from "@/utils/format"
|
|
|
|
// agent dropdown
|
|
export function useAgentDropdown() {
|
|
|
|
const agentOptions = ref([])
|
|
|
|
// specifing flat returns an array of hostnames versus {value:id, label: hostname}
|
|
async function getAgentOptions(flat = false) {
|
|
agentOptions.value = formatAgentOptions(await fetchAgents(), flat)
|
|
}
|
|
|
|
return {
|
|
//data
|
|
agentOptions,
|
|
|
|
//methods
|
|
getAgentOptions
|
|
}
|
|
}
|