Skip to content

A self-hosted media server and file management system

feat: remove manual type casting for content store

aminnausin3afddfdff2aa
diff --git a/resources/js/components/panels/VideoSidebar.vue b/resources/js/components/panels/VideoSidebar.vue
index cbfc6de2..3e2a362e 100755
--- a/resources/js/components/panels/VideoSidebar.vue
+++ b/resources/js/components/panels/VideoSidebar.vue
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { FolderResource, SeriesResource } from '@/types/resources';
import type { GenericSortOption, SortDir } from '@/types/types';
-import type { Ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useRecordsLimited } from '@/service/records/useRecords';
@@ -57,10 +56,7 @@ const folderSortDir = ref<SortDir>(1);
const folderSortKey = ref<keyof FolderResource>(folderSortingOptions[0].value);
const showFilters = ref(false);
-const { stateDirectory, stateFolder } = storeToRefs(useContentStore()) as unknown as {
- stateDirectory: Ref<{ name: string; folders: FolderResource[] }>;
- stateFolder: Ref<FolderResource>;
-};
+const { stateDirectory, stateFolder } = storeToRefs(useContentStore());
const { stateRecords, isLoading: isLoadingRecords } = useRecordsLimited(10);
diff --git a/resources/js/components/video/VideoAmbientPlayer.vue b/resources/js/components/video/VideoAmbientPlayer.vue
index f435de41..b0ade238 100755
--- a/resources/js/components/video/VideoAmbientPlayer.vue
+++ b/resources/js/components/video/VideoAmbientPlayer.vue
@@ -1,7 +1,4 @@
<script setup lang="ts">
-import type { VideoResource } from '@/types/resources';
-import type { Ref } from 'vue';
-
import { nextTick, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
import { useContentStore } from '@/stores/ContentStore';
import { useAppStore } from '@/stores/AppStore';
@@ -10,7 +7,7 @@ import { storeToRefs } from 'pinia';
import VideoPlayer from '@/components/video/VideoPlayer.vue';
const { lightMode, ambientMode } = storeToRefs(useAppStore());
-const { stateVideo } = storeToRefs(useContentStore()) as unknown as { stateVideo: Ref<VideoResource> };
+const { stateVideo } = storeToRefs(useContentStore());
const container = ref<null | HTMLElement>(null);
const player = ref<null | HTMLVideoElement>(null);
diff --git a/resources/js/components/video/VideoInfoPanel.vue b/resources/js/components/video/VideoInfoPanel.vue
index af33f4b4..26e2cd4b 100755
--- a/resources/js/components/video/VideoInfoPanel.vue
+++ b/resources/js/components/video/VideoInfoPanel.vue
@@ -1,7 +1,4 @@
<script setup lang="ts">
-import type { FolderResource, VideoResource } from '@/types/resources';
-import type { Ref } from 'vue';
-
import { computed, onMounted, ref, useTemplateRef, watch, nextTick } from 'vue';
import { handleStorageURL, toFormattedDate, toTimeSpan } from '@/service/util';
import { getUserViewCount } from '@/service/mediaAPI';
@@ -35,10 +32,7 @@ const showInfoAsChips = false;
const { userData } = storeToRefs(useAuthStore());
const { updateVideoData, updateFolderData } = useContentStore();
-const { stateVideo, stateFolder } = storeToRefs(useContentStore()) as unknown as {
- stateVideo: Ref<VideoResource>;
- stateFolder: Ref<FolderResource>;
-};
+const { stateVideo, stateFolder } = storeToRefs(useContentStore());
const descriptionRef = useTemplateRef('description');
const popover = useTemplateRef('popover');
diff --git a/resources/js/components/video/VideoLyrics.vue b/resources/js/components/video/VideoLyrics.vue
index e6d8a237..3288dbf1 100644
--- a/resources/js/components/video/VideoLyrics.vue
+++ b/resources/js/components/video/VideoLyrics.vue
@@ -18,7 +18,7 @@ import ModalBase from '@/components/pinesUI/ModalBase.vue';
let unsubscribe: () => boolean;
const { stateLyrics, editLyricsModal, dirtyLyric, isLoadingLyrics } = storeToRefs(useLyricStore());
-const { stateVideo } = storeToRefs(useContentStore()) as unknown as { stateVideo: Ref<VideoResource> };
+const { stateVideo } = storeToRefs(useContentStore());
const { handleGenerateLyrics, handleOpenLyricsModal } = useLyricStore();
const { updateVideoData } = useContentStore();
diff --git a/resources/js/stores/LyricStore.ts b/resources/js/stores/LyricStore.ts
index 37bfc70e..93f48683 100644
--- a/resources/js/stores/LyricStore.ts
+++ b/resources/js/stores/LyricStore.ts
@@ -1,7 +1,5 @@
-import type { VideoResource } from '@/types/resources';
import type { LrcLibResult } from '@/types/types';
import type { Metadata } from '@/types/model';
-import type { Ref } from 'vue';
import { fetchSyncedLyrics, searchSyncedLyrics } from '@/service/lyricsService';
import { defineStore, storeToRefs } from 'pinia';
@@ -14,7 +12,7 @@ import useModal from '@/composables/useModal';
type SelectedLyric = (LrcLibResult & { source: 'search' | 'generated' }) | null;
export const useLyricStore = defineStore('Lyric', () => {
- const { stateVideo } = storeToRefs(useContentStore()) as unknown as { stateVideo: Ref<VideoResource, VideoResource> };
+ const { stateVideo } = storeToRefs(useContentStore());
const editLyricsModal = useModal({ title: 'Edit Song Lyrics', submitText: 'Submit Changes' });
diff --git a/resources/js/views/VideoView.vue b/resources/js/views/VideoView.vue
index 3c9dd0bd..9dd42d3e 100755
--- a/resources/js/views/VideoView.vue
+++ b/resources/js/views/VideoView.vue
@@ -1,7 +1,6 @@
<script setup lang="ts">
-import type { CategoryResource, FolderResource, VideoResource } from '@/types/resources';
+import type { VideoResource } from '@/types/resources';
import type { SortDir } from '@/service/sort/types';
-import type { Ref } from 'vue';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
import { useRecordsLimited } from '@/service/records/useRecords';
@@ -28,13 +27,7 @@ const route = useRoute();
// const { getRecords } = useRecordsLimited();
const { selectedSideBar, pageTitle } = storeToRefs(useAppStore());
const { getFolder, getCategory, playlistFind, playlistSort, updateVideoData } = useContentStore();
-const { searchQuery, stateFilteredPlaylist, stateDirectory, stateVideo, stateFolder } = storeToRefs(useContentStore()) as unknown as {
- searchQuery: Ref<string>;
- stateFilteredPlaylist: Ref<VideoResource[]>;
- stateDirectory: Ref<CategoryResource>;
- stateVideo: Ref<VideoResource>;
- stateFolder: Ref<FolderResource>;
-};
+const { searchQuery, stateFilteredPlaylist, stateDirectory, stateVideo, stateFolder } = storeToRefs(useContentStore());
const editVideoModal = useModal({ title: 'Edit Video Details', submitText: 'Submit Details' });
const shareVideoModal = useModal({ title: 'Share Video' });