import { create } from 'axios'; import { ref } from 'vue'; import HistoryData = App.Features.History.Data.HistoryData; export default function useHistoryViewModel() { const isLoading = ref(false); const historyData = ref(); function getHistoryData(date: string) { isLoading.value = true; const client = create(); client .get('/api/history', { params: { date, }, }) .then((res) => { historyData.value = res.data; }) .finally(() => (isLoading.value = false)); } return { isLoading, historyData, getHistoryData }; }