base_ui/composables/useMyComposable.ts

45 lines
819 B
TypeScript
Raw Permalink Normal View History

2025-02-01 09:34:55 +00:00
import { useStorage } from "@vueuse/core";
import { ref } from "vue";
import { useCommonStore } from "~/stores/commonStore";
export function useMyComposable() {
const count = ref(0);
const increment = () => {
count.value++;
};
const decrement = () => {
count.value--;
};
return {
count,
increment,
decrement,
};
}
export function useGetSchema() {
const commonStore = useCommonStore();
try {
return useAsyncData("shema", () =>
$fetch("/api/ali", {
headers: {
headers: { Authorization: useStorage("id_token") },
},
method: "post",
body: {
organ: commonStore.organNameGetter,
system: "search",
build_state: buildState(),
},
})
);
} catch (err) {
console.info(err);
}
}