ruins
Version:
> [!IMPORTANT] > This is in beta. Not everything is ironed out and some modules might misbehave
23 lines (18 loc) • 527 B
text/typescript
import { ref, onMounted } from "vue";
import { fetchy } from "../fetchy";
import type { RulesRes } from "../../../api/server/api/eslint/rules";
export function useRules() {
const data = ref<RulesRes["data"]>();
const totals = ref();
const hasData = ref(true);
onMounted(async () => {
const res = await fetchy<RulesRes>("/eslint/rules");
if (!res.data) {
hasData.value = false;
return;
}
data.value = res?.data;
totals.value = res?.totals;
});
return { data, hasData, totals };
}