Files
job-tracker/web/src/stores/analytics.js
T
adamf 1147bc5697
Test and publish / test (push) Successful in 2m33s
Test and publish / publish (push) Successful in 11m9s
Add application workflow and lead analytics
2026-10-23 20:45:48 +01:00

29 lines
839 B
JavaScript

import { defineStore } from "pinia";
import { gql } from "@/graphql";
export const useAnalyticsStore = defineStore("analytics", {
state: () => ({ data: null, loading: false, error: null }),
actions: {
async fetch() {
this.loading = true;
this.error = null;
try {
const result = await gql(`query DashboardAnalytics {
analytics {
totalApplications statusCounts { status count }
transitions { from to count }
responseCount interviewCount offerCount
responseRate interviewRate offerRate
averageDaysToResponse averageDaysToInterview averageDaysToOffer
}
}`);
this.data = result.analytics;
} catch (error) {
this.error = error;
} finally {
this.loading = false;
}
},
},
});