import { defineStore } from "pinia"; import { ref } from "vue"; import { api } from "../api/client"; export interface Label { id: string; name: string; color: string; } export const useLabelsStore = defineStore("labels", () => { const items = ref([]); const loaded = ref(false); function sort() { items.value.sort((a, b) => a.name.localeCompare(b.name)); } async function load(): Promise { const res = await api.get<{ labels: Label[] }>("/api/labels"); items.value = res.labels; loaded.value = true; } async function create(name: string): Promise