feat(wip): gameConstStore inject

This commit is contained in:
2022-04-07 03:03:38 +09:00
parent d456504225
commit b714c7dff1
2 changed files with 22 additions and 8 deletions
+16 -7
View File
@@ -1,12 +1,7 @@
<template>
<BContainer id="container" :toast="{ root: true }" class="pageNationGeneral bg0">
<TopBackBar :title="title" />
<Suspense>
<GeneralList :list="generalList" :height="'fill'" />
<template #fallback>
불러오는 중입니다...
</template>
</Suspense>
<GeneralList v-if="asyncReady" :list="generalList" :height="'fill'" />
<BottomBar />
</BContainer>
</template>
@@ -22,16 +17,30 @@
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { BContainer } from "bootstrap-vue-3";
import { onMounted, ref } from "vue";
import { onMounted, provide, ref } from "vue";
import { SammoAPI } from "./SammoAPI";
import { merge2DArrToObjectArr } from "./util/merge2DArrToObjectArr";
import type { GeneralListItem } from "./defs/API/Nation";
import GeneralList from "./components/GeneralList.vue";
import { type GameConstStore, getGameConstStore } from "./GameConstStore";
const generalList = ref<GeneralListItem[]>([]);
const gameConstStore = ref<GameConstStore>();
provide('gameConstStore', gameConstStore);
const asyncReady = ref(false);
const title = "세력 장수";
const storeP = getGameConstStore().then((store)=>{
gameConstStore.value = store;
});
void Promise.all([storeP]).then(()=>{
asyncReady.value = true;
});
onMounted(async () => {
try {
const { column, list, permission } = await SammoAPI.Nation.GeneralList();