Fix storage bugs from refactor

This commit is contained in:
Georges-Antoine Assi
2023-07-30 17:45:58 -04:00
parent c79751f88e
commit af364cfc9a
4 changed files with 7 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ emitter.on("refreshGallery", () => {
onMounted(async () => {
try {
const { data } = await fetchPlatformsApi();
platforms.set(data.data);
platforms.set(data);
} catch (error) {
console.error("Couldn't fetch platforms:", error);
}

View File

@@ -1,5 +1,6 @@
<script setup>
import { inject, ref, onMounted } from "vue";
import { debounce } from "lodash";
import storeGalleryFilter from "@/stores/galleryFilter.js";
// Props

View File

@@ -3,20 +3,15 @@ import { defineStore } from "pinia";
export default defineStore("platforms", {
state: () => {
return {
platforms: []
value: [],
};
},
getters: {
totalGames: ({ platforms }) => {
debugger;
platforms?.reduce((count, p) => {
return count + p.n_roms;
}, 0) ?? 0;
},
totalGames: ({ value }) => value.reduce((count, p) => count + p.n_roms, 0),
},
actions: {
set(platforms) {
this.platforms = platforms;
this.value = platforms;
},
},
});

View File

@@ -5,6 +5,7 @@ import { fetchRomsApi } from "@/services/api.js";
import socket from "@/services/socket.js";
import { views } from "@/utils/utils.js";
import storeGalleryFilter from "@/stores/galleryFilter.js";
import storeGalleryView from "@/stores/galleryView.js";
import storeScanning from "@/stores/scanning.js";
import FilterBar from "@/components/GalleryAppBar/FilterBar.vue";
import GalleryViewBtn from "@/components/GalleryAppBar/GalleryViewBtn.vue";
@@ -17,6 +18,7 @@ const route = useRoute();
const roms = ref([]);
const searchRoms = ref([]);
const filteredRoms = ref([]);
const galleryView = storeGalleryView();
const galleryFilter = storeGalleryFilter();
const gettingRoms = ref(false);
const scanning = storeScanning();