Skip to content

Commit

Permalink
Merge pull request #338 from lovegaoshi/dev
Browse files Browse the repository at this point in the history
fix: error logs
  • Loading branch information
lovegaoshi authored Mar 6, 2024
2 parents b05c19b + 4eb77d5 commit ee1ca2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/stores/playingList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import TrackPlayer, { RepeatMode } from 'react-native-track-player';
import { clearPlaylistUninterrupted } from '@utils/RNTPUtils';
import { NoxRepeatMode } from '../enums/RepeatMode';
import { savePlayMode } from '@utils/ChromeStorage';
import logger from '@utils/Logger';

interface NoxPlaylistStore {
playingList: Array<NoxMedia.Song>;
Expand All @@ -26,10 +27,18 @@ const playlistStore = createStore<NoxPlaylistStore>(() => ({
}));

export const setPlayingIndex = (index = 0, songId?: string) => {
const currentQueue = getCurrentTPQueue();
if (songId) {
index = getCurrentTPQueue().findIndex(v => v.id === songId);
index = currentQueue.findIndex(v => v.id === songId);
} else {
songId = getCurrentTPQueue()[index].id;
try {
songId = currentQueue[index].id;
} catch {
logger.warn(
`[setPlayingIndex] could not get index ${index} from current queue: ${JSON.stringify(currentQueue)} `
);
return;
}
}
playlistStore.setState({
currentPlayingIndex: index,
Expand Down
1 change: 0 additions & 1 deletion src/utils/mediafetch/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const fetchPaginatedAPI = async ({
})
.catch((err: any) => {
console.error(err, pages);
pages.text().then(console.log);
});
})
);
Expand Down
1 change: 0 additions & 1 deletion src/utils/mediafetch/paginatedfetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const fetchPaginatedAPI = async ({
})
.catch((err: any) => {
console.error(err, pages);
pages.text().then(console.log);
});
})
);
Expand Down

0 comments on commit ee1ca2b

Please sign in to comment.