|
@@ -1,42 +1,32 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { defineAsyncComponent, shallowRef } from "vue";
|
|
|
|
|
|
+import { shallowRef } from "vue";
|
|
import { storeToRefs } from "pinia";
|
|
import { storeToRefs } from "pinia";
|
|
-import { useModalsStore } from "@/stores/modals";
|
|
|
|
|
|
+import { useModalsStore, useModalComponents } from "@/stores/modals";
|
|
|
|
|
|
const modalsStore = useModalsStore();
|
|
const modalsStore = useModalsStore();
|
|
const { modals, activeModals } = storeToRefs(modalsStore);
|
|
const { modals, activeModals } = storeToRefs(modalsStore);
|
|
|
|
|
|
-const useModalComponents = (map: { [key: string]: string }) => {
|
|
|
|
- const modalComponents: { [key: string]: string } = {};
|
|
|
|
- Object.entries(map).forEach(([mapKey, mapValue]) => {
|
|
|
|
- modalComponents[mapKey] = defineAsyncComponent(
|
|
|
|
- () => import(`./modals/${mapValue}.vue`)
|
|
|
|
- );
|
|
|
|
- });
|
|
|
|
- return modalComponents;
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
const modalComponents = shallowRef(
|
|
const modalComponents = shallowRef(
|
|
- useModalComponents({
|
|
|
|
- editUser: "EditUser",
|
|
|
|
- login: "Login",
|
|
|
|
- register: "Register",
|
|
|
|
- whatIsNew: "WhatIsNew",
|
|
|
|
- createStation: "CreateStation",
|
|
|
|
- editNews: "EditNews",
|
|
|
|
- manageStation: "ManageStation/index",
|
|
|
|
- editPlaylist: "EditPlaylist/index",
|
|
|
|
- createPlaylist: "CreatePlaylist",
|
|
|
|
- report: "Report",
|
|
|
|
- viewReport: "ViewReport",
|
|
|
|
- bulkActions: "BulkActions",
|
|
|
|
- viewApiRequest: "ViewApiRequest",
|
|
|
|
- viewPunishment: "ViewPunishment",
|
|
|
|
- removeAccount: "RemoveAccount",
|
|
|
|
- importAlbum: "ImportAlbum",
|
|
|
|
- confirm: "Confirm",
|
|
|
|
- editSong: "EditSong/index",
|
|
|
|
- viewYoutubeVideo: "ViewYoutubeVideo"
|
|
|
|
|
|
+ useModalComponents("components/modals", {
|
|
|
|
+ editUser: "EditUser.vue",
|
|
|
|
+ login: "Login.vue",
|
|
|
|
+ register: "Register.vue",
|
|
|
|
+ whatIsNew: "WhatIsNew.vue",
|
|
|
|
+ createStation: "CreateStation.vue",
|
|
|
|
+ editNews: "EditNews.vue",
|
|
|
|
+ manageStation: "ManageStation/index.vue",
|
|
|
|
+ editPlaylist: "EditPlaylist/index.vue",
|
|
|
|
+ createPlaylist: "CreatePlaylist.vue",
|
|
|
|
+ report: "Report.vue",
|
|
|
|
+ viewReport: "ViewReport.vue",
|
|
|
|
+ bulkActions: "BulkActions.vue",
|
|
|
|
+ viewApiRequest: "ViewApiRequest.vue",
|
|
|
|
+ viewPunishment: "ViewPunishment.vue",
|
|
|
|
+ removeAccount: "RemoveAccount.vue",
|
|
|
|
+ importAlbum: "ImportAlbum.vue",
|
|
|
|
+ confirm: "Confirm.vue",
|
|
|
|
+ editSong: "EditSong/index.vue",
|
|
|
|
+ viewYoutubeVideo: "ViewYoutubeVideo.vue"
|
|
})
|
|
})
|
|
);
|
|
);
|
|
</script>
|
|
</script>
|