Skip to content

Commit

Permalink
fix: Type issue in fetchPlaylist call by adding type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
arjitcodes committed Nov 14, 2024
1 parent c012d97 commit 55b824e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions zimui/src/views/TabView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ const isLoading = ref(true)
// Fetch the videos for the playlist
const fetchData = async function () {
const currentPlaylist = main.channel?.[props.playlistSlug as keyof typeof main.channel]
if (typeof currentPlaylist !== 'string') {
main.setErrorMessage('An unexpected error occurred when fetching videos.')
}
if (currentPlaylist) {
try {
if (typeof currentPlaylist !== 'string') throw new Error()
const resp = await main.fetchPlaylist(currentPlaylist)
if (resp) {
playlist.value = resp
Expand Down

0 comments on commit 55b824e

Please sign in to comment.