Removed unnecessary types and fixed some bugs
This commit is contained in:
parent
441d8a42a3
commit
62e3869ce9
8 changed files with 16 additions and 46 deletions
src/utils
|
@ -1,16 +1,14 @@
|
|||
import { getEntry } from 'astro:content'
|
||||
import type { GlobImage, ImportRecord } from '../types/generic'
|
||||
|
||||
export function plsLoadImage(
|
||||
record: Record<string, () => Promise<{ default: ImageMetadata }>>,
|
||||
path: string
|
||||
) {
|
||||
export function plsLoadImage(record: ImportRecord<GlobImage>, path: string) {
|
||||
const loadedImage = record[path]?.()
|
||||
if (!loadedImage) throw new Error('Asset was not found:' + path)
|
||||
if (!loadedImage) throw new Error(`Asset was not found for path ${path}`)
|
||||
return loadedImage
|
||||
}
|
||||
|
||||
export async function plsLoadTAEntry(key: string) {
|
||||
const filecontent = (await getEntry('taInfoData', key))?.data
|
||||
if (!filecontent) throw new Error(`Datafile ${key} is missing!`)
|
||||
if (!filecontent) throw new Error(`Datafile was not found for key ${key}`)
|
||||
return filecontent
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue