Start moving data server handling from pinia store to server
This commit is contained in:
19
software/src/data/stores/shoppingStore.ts
Normal file
19
software/src/data/stores/shoppingStore.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import { EventModel } from "../models/acts/eventModel";
|
||||
import { fetchEvents } from "../api/eventApi";
|
||||
|
||||
export const useShoppingStore = defineStore("shoppingStore", {
|
||||
state: () => ({
|
||||
events: ref<Array<EventModel>>([])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
getEvents(city: string = "", genre: string = "") {
|
||||
fetchEvents(city, genre)
|
||||
.then(result => {
|
||||
this.events = result.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user