File browser on admin page

This commit is contained in:
2024-11-05 19:54:14 +01:00
parent ce097e2098
commit b7eca62403
11 changed files with 167 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ import { useLocalStorage } from "@vueuse/core";
import { ThemeEnum } from "../data/enums/themeEnums";
import { LanguageEnum } from "../data/enums/languageEnum";
import { ref } from "vue";
import { fetchServerState, resetDatabase, resetExerciseProgress } from "@/data/api/mainApi";
import { fetchFileNames, fetchServerState, resetDatabase, resetExerciseProgress } from "@/data/api/mainApi";
import { ServerStateEnum } from "@/data/enums/serverStateEnum";
import { BannerStateEnum } from "@/data/enums/bannerStateEnum";
import { useFeedbackStore } from "./feedback.store";
@@ -26,7 +26,9 @@ export const usePreferencesStore = defineStore('preferencesStore', {
showDeleteDbDialog: ref(false),
/** Show the "Delete Exercise progress?" confirm dialog */
showDeleteExerciseDialog: ref(false)
showDeleteExerciseDialog: ref(false),
staticFiles: ref([])
}),
actions: {
@@ -90,6 +92,16 @@ export const usePreferencesStore = defineStore('preferencesStore', {
this.fetchInProgress = false
this.showDeleteExerciseDialog = false
})
},
async getStaticFiles() {
this.fetchInProgress = true
fetchFileNames()
.then(res => {
this.staticFiles = res.data
this.fetchInProgress = false
})
}
}
})