Files
interview-demo-code/frontend/admin/src/stores/stats.js
Nikita Kiselev 952d8e58da feat(customers): track order meta and OC sync
- add telecart_order_meta table and orders_count column for customers
- introduce OcCustomerService and OrderMetaService for syncing OC data
- rework OrderCreateService transaction flow, metadata handling and tests
- increment telegram customer orders_count and expose it via handlers/UI
- update stats dashboard with rub formatting, tooltips and customers count
- sync SPA theme colors with Telegram WebApp and fix dark variant behavior
- add helpers for RUB formatting and bool casting; simplify logs handler
2025-11-24 14:11:31 +03:00

23 lines
603 B
JavaScript

import {defineStore} from "pinia";
import {apiGet, apiPost} from "@/utils/http.js";
export const useStatsStore = defineStore('stats', {
state: () => ({
items: {
orders_count: null,
orders_total_amount: null,
customers_count: null,
}
}),
actions: {
async fetchStats() {
const response = await apiPost('getDashboardStats');
this.items.orders_count = response.data?.data?.orders_count;
this.items.orders_total_amount = response.data?.data?.orders_total_amount;
this.items.customers_count = response.data?.data?.customers_count;
}
},
});