mirror of
https://github.com/maciejpedzich/spotifyplaylistarchive.com.git
synced 2024-09-19 18:16:19 +02:00
Don't throw an error for empty commit listings
This commit is contained in:
parent
c1fcc1c455
commit
7528491f03
@ -28,9 +28,6 @@ export default defineEventHandler(async (event) => {
|
||||
until
|
||||
});
|
||||
|
||||
if (commitListings.length === 0)
|
||||
throw new Error('There are no archive entries of this playlist');
|
||||
|
||||
const snapshotFileContents = await Promise.all(
|
||||
commitListings.map(({ sha }) =>
|
||||
$fetch<{ snapshot_id: string }>(
|
||||
@ -41,14 +38,14 @@ export default defineEventHandler(async (event) => {
|
||||
);
|
||||
const possiblyDuplicateSnapshotEntries = snapshotFileContents.map(
|
||||
({ snapshot_id }, index) => ({
|
||||
snapshot_id,
|
||||
commit_sha: commitListings[index].sha,
|
||||
date_captured: commitListings[index].commit.author.date
|
||||
snapshotId: snapshot_id,
|
||||
commitSha: commitListings[index].sha,
|
||||
dateCaptured: commitListings[index].commit.author.date
|
||||
})
|
||||
);
|
||||
const uniqueSnapshotEntries = filterByUniqueKeyValue(
|
||||
possiblyDuplicateSnapshotEntries,
|
||||
'snapshot_id'
|
||||
'snapshotId'
|
||||
);
|
||||
|
||||
return uniqueSnapshotEntries;
|
||||
|
Loading…
Reference in New Issue
Block a user