diff --git a/src/utils/data.utils.ts b/src/utils/data.utils.ts index 9fb4d45..7ae95fa 100644 --- a/src/utils/data.utils.ts +++ b/src/utils/data.utils.ts @@ -1,5 +1,3 @@ -import { LPE } from '@/types/lpe.types' - function hasClassName(inputString: string, className: string) { const regex = new RegExp(`class\\s*=\\s*"[^"]*\\b${className}\\b[^"]*"`) return regex.test(inputString) @@ -25,29 +23,6 @@ export const shuffle = (array: any[]) => { return array } -export const unique = (arr: any[]) => Array.from(new Set(arr)) - -export const getAudioSourceFromEpisode = async (episodId: string) => { - const myHeaders = new Headers() - myHeaders.append( - 'Authorization', - 'Bearer eyJhcGlfa2V5IjoiMzg3OTdhY2Y5N2NmZjgzZjQxNGI5ODNiN2E2MjY3NmQifQ==', - ) - - const requestOptions = { - method: 'GET', - headers: myHeaders, - } - - const result = await fetch( - `https://api.simplecast.com/episodes/${episodId}`, - requestOptions, - ) - - const data = await result.json() - return data -} - export const parseInt = ( inp: any, defaultValue?: number, @@ -68,40 +43,3 @@ export const parseInt = ( return defaultValue } - -export const transformPostData = ( - post: LPE.Post.Document, - shows: LPE.Podcast.Show[] = [], -) => { - const show = - post.type === 'podcast' - ? post.show || shows.find((show) => show.id === post.showId) || shows[0] - : undefined - - return { - date: - post.type === 'podcast' - ? post.publishedAt - ? new Date(post.publishedAt) - : null - : post.modifiedAt - ? new Date(post.modifiedAt) - : null, - slug: post.slug, - title: post.title, - authors: post.type === 'article' ? post.authors : [], - coverImage: post.coverImage, - subtitle: (post.type === 'article' && post.subtitle) || '', - tags: post.tags, - ...(post.type === 'podcast' && show - ? { - podcastShowDetails: { - episodeNumber: post.episodeNumber, - title: show.title, - slug: show.slug, - podcast: show, - }, - } - : {}), - } -}