Redesign home page
This commit is contained in:
36
software/src/data/stores/showStore.ts
Normal file
36
software/src/data/stores/showStore.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import { defineStore } from "pinia";
|
||||
import { TourModel } from "../models/tourModel";
|
||||
import { getAllTours } from "../api/tourApi";
|
||||
import { GenreModel } from "../models/genreModel";
|
||||
import { getAllBands } from "../api/bandApi";
|
||||
import { BandModel } from "../models/bandModel";
|
||||
import { LocationModel } from "../models/locationModel";
|
||||
import { getAllLocations } from "../api/locationApi";
|
||||
|
||||
export const useShowStore = defineStore("showStore", {
|
||||
state: () => ({
|
||||
tours: useLocalStorage<Array<TourModel>>("hackmycart/showStore/tours", []),
|
||||
bands: useLocalStorage<Array<BandModel>>("hackmycart/showStore/bands", []),
|
||||
locations: useLocalStorage<Array<LocationModel>>("hackmycart/showStore/locations", [])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async fetchAllTours() {
|
||||
await getAllTours()
|
||||
.then(result => {
|
||||
this.tours = result.data
|
||||
})
|
||||
|
||||
await getAllBands()
|
||||
.then(result => {
|
||||
this.bands = result.data
|
||||
})
|
||||
|
||||
await getAllLocations()
|
||||
.then(result => {
|
||||
this.locations = result.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -1,21 +0,0 @@
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import { defineStore } from "pinia";
|
||||
import { TourModel } from "../models/tourModel";
|
||||
import { getAllTours } from "../api/tourApi";
|
||||
import { GenreModel } from "../models/genreModel";
|
||||
|
||||
export const useTourStore = defineStore("tourStore", {
|
||||
state: () => ({
|
||||
tours: useLocalStorage<Array<TourModel>>("hackmycart/tourStore/tours", []),
|
||||
genres: useLocalStorage<Array<GenreModel>>("hackmycart/tourStore/genres", [])
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async fetchAllTours() {
|
||||
await getAllTours()
|
||||
.then(result => {
|
||||
this.tours = result.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user