Skip to content

Commit

Permalink
chore: fix lovecast
Browse files Browse the repository at this point in the history
  • Loading branch information
moekify committed Aug 18, 2024
1 parent ce28df4 commit e76f856
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = {
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
},
varsIgnorePattern: '^_'
}
]
};
13 changes: 7 additions & 6 deletions src/routes/lovecasts/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import { directus, status } from '$lib/_directus';
import { readItems } from '@directus/sdk';
import type { ConvertedLovecast } from './_types';

const episodeNumberRegex = /(\w+cast)\s+(\d{1,4})/i;

export const load = async () => {
const lovecasts = await directus()
.items('lovecast')
.readByQuery({
const lovecasts = await directus.request(
readItems('lovecast', {
fields: ['id', 'name_of_the_set', 'design', 'soundcloud_link', 'type'],
filter: {
status: {
_in: status
}
},
limit: -1
});
})
);

if (!lovecasts.data) {
if (!lovecasts) {
throw new Error('No lovecasts found');
}

const lovecastsData: ConvertedLovecast[] = lovecasts.data
const lovecastsData: ConvertedLovecast[] = lovecasts
.map((lovecast) => {
const { id, name_of_the_set, design, soundcloud_link, type } = lovecast;
const [_, regexCastType, episodeNumber] = name_of_the_set?.match(episodeNumberRegex) ?? [];
Expand Down

0 comments on commit e76f856

Please sign in to comment.