extract to a new store: dashboardStore
This commit is contained in:
22
src/modules/dashboard/dashboard-store.ts
Normal file
22
src/modules/dashboard/dashboard-store.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Dashboard } from '@/store-type'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
type State = {
|
||||
dashboards: Dashboard[]
|
||||
}
|
||||
|
||||
export const useDashboardStore = defineStore('dashboard', {
|
||||
state: (): State => {
|
||||
return {
|
||||
dashboards: []
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
newDashboard(dashboard: Dashboard) {
|
||||
this.dashboards.push(dashboard)
|
||||
},
|
||||
clearDashboard() {
|
||||
this.dashboards = []
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user