add default config to store

This commit is contained in:
Georges-Antoine Assi
2024-05-23 14:11:39 -04:00
parent a6a892b31c
commit 6d803bfbdb
2 changed files with 19 additions and 5 deletions

View File

@@ -104,10 +104,6 @@ onBeforeUnmount(() => {
});
onMounted(() => {
// api.get("/config").then(({ data: data }) => {
// configStore.set(data);
// });
api.get("/heartbeat").then(({ data: data }) => {
heartbeat.set(data);
});
@@ -117,6 +113,10 @@ function fetchHomeData() {
// Remove it so it's not called multiple times
document.removeEventListener("network-quiesced", fetchHomeData);
api.get("/config").then(({ data: data }) => {
configStore.set(data);
});
userApi
.fetchCurrentUser()
.then(({ data: user }) => {

View File

@@ -4,7 +4,21 @@ import type { ConfigResponse } from "@/__generated__";
export default defineStore("config", {
state: () => {
return { value: {} as ConfigResponse };
return {
value: {
EXCLUDED_PLATFORMS: [] as string[],
EXCLUDED_SINGLE_EXT: [] as string[],
EXCLUDED_SINGLE_FILES: [] as string[],
EXCLUDED_MULTI_FILES: [] as string[],
EXCLUDED_MULTI_PARTS_EXT: [] as string[],
EXCLUDED_MULTI_PARTS_FILES: [] as string[],
PLATFORMS_BINDING: {} as Record<string, string>,
PLATFORMS_VERSIONS: {} as Record<string, string>,
ROMS_FOLDER_NAME: "",
FIRMWARE_FOLDER_NAME: "",
HIGH_PRIO_STRUCTURE_PATH: "",
},
};
},
actions: {