25 lines
814 B
TypeScript
25 lines
814 B
TypeScript
import { defineStore } from 'pinia'
|
|
|
|
export const useMarketplaceStore = defineStore('marketplace', {
|
|
state: () => ({
|
|
minCost: null as number | null,
|
|
maxCost: null as number | null,
|
|
rarities: [] as string[],
|
|
cardset: [] as string[],
|
|
}),
|
|
actions: {
|
|
setFilters(filters: Partial<{ minCost: number, maxCost: number, rarities: string[], cardset: string[] }>) {
|
|
if (filters.minCost !== undefined) this.minCost = filters.minCost
|
|
if (filters.maxCost !== undefined) this.maxCost = filters.maxCost
|
|
if (filters.rarities !== undefined) this.rarities = filters.rarities
|
|
if (filters.cardset !== undefined) this.cardset = filters.cardset
|
|
},
|
|
clearFilters() {
|
|
this.minCost = null
|
|
this.maxCost = null
|
|
this.rarities = []
|
|
this.cardset = []
|
|
}
|
|
}
|
|
})
|