Manages product state via Pinia, exposing reactive data and computed getters.
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { createSampleItems, deleteSampleItems } from '../services/api'
import { useShiftStore } from './shift'
import { db } from '@/db/indexedDB'
import { isOffline } from '@/db/network'
import { createListResource } from 'frappe-ui'
export const useProductsStore = defineStore('products', () => {
const products = ref([])
const allProducts = ref([])
const priceLists = ref([])
const warehouses = ref([])
const itemGroups = ref([])
const isLoading = ref(false)
const searchKeyword = ref('')
const searchContext = ref({})
const selectedPriceList = ref('')
const selectedWarehouse = ref('')
const error = ref(null)
const filteredProducts = computed(() => {
if (!searchKeyword.value) return products
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key